結果

問題 No.1420 国勢調査 (Easy)
ユーザー tailstails
提出日時 2021-03-09 21:17:08
言語 cLay
(20240104-1)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 5,561 ms
コンパイル使用メモリ 163,640 KB
実行使用メモリ 13,968 KB
最終ジャッジ日時 2023-09-19 02:14:44
合計ジャッジ時間 6,418 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,596 KB
testcase_01 AC 2 ms
5,444 KB
testcase_02 AC 13 ms
10,160 KB
testcase_03 AC 13 ms
10,192 KB
testcase_04 AC 13 ms
10,364 KB
testcase_05 AC 13 ms
10,224 KB
testcase_06 AC 13 ms
10,248 KB
testcase_07 AC 12 ms
10,124 KB
testcase_08 AC 12 ms
10,096 KB
testcase_09 AC 12 ms
10,128 KB
testcase_10 AC 12 ms
10,360 KB
testcase_11 AC 11 ms
9,952 KB
testcase_12 AC 5 ms
8,544 KB
testcase_13 AC 7 ms
8,604 KB
testcase_14 AC 5 ms
8,580 KB
testcase_15 AC 7 ms
8,660 KB
testcase_16 AC 7 ms
8,612 KB
testcase_17 AC 7 ms
8,604 KB
testcase_18 AC 7 ms
8,564 KB
testcase_19 AC 7 ms
8,608 KB
testcase_20 AC 7 ms
8,588 KB
testcase_21 AC 7 ms
8,584 KB
testcase_22 AC 26 ms
13,748 KB
testcase_23 AC 26 ms
13,968 KB
testcase_24 AC 27 ms
13,932 KB
testcase_25 AC 27 ms
13,748 KB
testcase_26 AC 27 ms
13,724 KB
testcase_27 AC 14 ms
12,476 KB
testcase_28 AC 14 ms
12,368 KB
testcase_29 AC 14 ms
12,460 KB
testcase_30 AC 15 ms
12,340 KB
testcase_31 AC 14 ms
11,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

wgraph<int> g;
int a[1d5],b[],y[],r[],u[];

void f(int i){
	rep(j,g.es[i]){
		int k=g.edge[i][j];
		if(u[k]){
			if(r[i]^r[k]^g.cost[i][j]){
				wt(-1);
				exit(0);
			}
		}else{
			u[k]=1;
			r[k]=r[i]^g.cost[i][j];
			f(k);
		}
	}
}

{
	int @n,@m;
	rd((a--,b--,y)(m));
	g.setEdge(n,m,a,b,y);
	rep(i,n) if(!u[i]) u[i]=1, f(i);
	wtLn(r(n));
}
0