結果

問題 No.1420 国勢調査 (Easy)
ユーザー tailstails
提出日時 2021-03-09 21:12:29
言語 cLay
(20240104-1)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 2,377 ms
コンパイル使用メモリ 163,620 KB
実行使用メモリ 13,812 KB
最終ジャッジ日時 2023-09-19 02:14:16
合計ジャッジ時間 5,862 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,348 KB
testcase_01 AC 2 ms
5,388 KB
testcase_02 AC 13 ms
10,440 KB
testcase_03 AC 13 ms
10,268 KB
testcase_04 AC 14 ms
10,152 KB
testcase_05 AC 13 ms
10,356 KB
testcase_06 AC 13 ms
10,208 KB
testcase_07 AC 12 ms
10,264 KB
testcase_08 AC 11 ms
10,092 KB
testcase_09 AC 12 ms
10,148 KB
testcase_10 AC 12 ms
10,284 KB
testcase_11 AC 11 ms
9,952 KB
testcase_12 AC 5 ms
8,776 KB
testcase_13 AC 7 ms
8,576 KB
testcase_14 AC 5 ms
8,540 KB
testcase_15 AC 7 ms
8,624 KB
testcase_16 AC 7 ms
8,620 KB
testcase_17 AC 7 ms
8,680 KB
testcase_18 AC 7 ms
8,568 KB
testcase_19 AC 7 ms
8,860 KB
testcase_20 AC 7 ms
8,616 KB
testcase_21 AC 7 ms
8,584 KB
testcase_22 AC 27 ms
13,696 KB
testcase_23 AC 28 ms
13,752 KB
testcase_24 AC 28 ms
13,812 KB
testcase_25 AC 28 ms
13,756 KB
testcase_26 AC 26 ms
13,756 KB
testcase_27 AC 14 ms
12,420 KB
testcase_28 AC 14 ms
12,400 KB
testcase_29 AC 14 ms
12,432 KB
testcase_30 AC 15 ms
12,516 KB
testcase_31 AC 15 ms
12,476 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]) f(i);
	wtLn(r(n));
}
0