unknown error 是为啥呀,是uva炸了吗
查看原帖
unknown error 是为啥呀,是uva炸了吗
149769
Zkxxxv_h楼主2023/1/12 14:56
#include<bits/stdc++.h> 
using namespace std;
int read() {
    int sum = 0 , w = 1 ; char c = getchar();
    while( c < '0' || c > '9') {
        if(c == '-') w = -1;
        c = getchar();}
    while(c >= '0' && c <= '9') {
        sum = sum * 10 + c - '0';
        c = getchar();}
    return sum * w;
}
int cnt, ans;
int f[1000111];
struct node{
	int a,b,h;
}tower[1000000];
bool pd(int x, int y) {
	if((tower[x].a < tower[y].a && tower[x].b < tower[y].b) ||
		(tower[x].b < tower[y].a && tower[x].a < tower[y].b))
	return true;
	return false;	
}
int dfs(int u) {
	if(f[u]) return f[u];
	f[u] = tower[u].h;
	for(int i = 1; i <= cnt; i++) {
		if(pd(i, u)) {//i可以放u上 
			f[u] = max(f[u], dfs(i) + tower[u].h);
		}
	}
	return f[u];
}
int main() {
	int n = -1, k = 0;
	while(n) {
		n = read();
		if(n == 0) return 0;
		cnt = 0, ans = 0, memset(f, 0 ,sizeof f);
		while(n--) {
			int a = read(), b = read(), c = read();
			tower[++cnt] = (node){a,b,c},
			tower[++cnt] = (node){a,c,b},
			tower[++cnt] = (node){b,c,a};
		}
		printf("Case %d: maximum height = ", ++k);
//		for(int i = 1; i <= cnt; i++) 
//			f[i] = tower[i].h;
		for(int i = 1; i <= cnt; i++) {
			dfs(i);
			ans = max(ans, f[i]);
		}
		printf("%d\n", ans);
	}
	


	return 0;
}
/*
pika へ          /|
  /\7    ∠_/
  / │   / /
 │ Z _,< /   /`ヽ
 │ヽ   /  〉
  Y`     / /     |\
 /	●  ● / /  〈 \
 ()  へ   |  \〈
  >> __ <  │ //
  / へ  / <<| \\
  ヽ_) (_/  │//
  7|/		| / /
  >―r ̄ ̄`?―_6
*/


编译成功
UnexpectedResponse: got an unexpected response when requesting `https://onlinejudge.org`: unable to find `cbsecuritym3`
2023/1/12 14:56
加载中...