結果
問題 | No.1420 国勢調査 (Easy) |
ユーザー | Navier_Boltzmann |
提出日時 | 2022-02-13 20:14:45 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 728 bytes |
コンパイル時間 | 91 ms |
コンパイル使用メモリ | 10,976 KB |
実行使用メモリ | 56,448 KB |
最終ジャッジ日時 | 2023-09-11 15:39:27 |
合計ジャッジ時間 | 24,809 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 19 ms
8,584 KB |
testcase_01 | AC | 19 ms
8,492 KB |
testcase_02 | AC | 965 ms
45,872 KB |
testcase_03 | AC | 957 ms
45,872 KB |
testcase_04 | AC | 960 ms
45,780 KB |
testcase_05 | AC | 951 ms
45,776 KB |
testcase_06 | AC | 955 ms
45,788 KB |
testcase_07 | AC | 760 ms
45,908 KB |
testcase_08 | AC | 777 ms
45,916 KB |
testcase_09 | AC | 803 ms
45,784 KB |
testcase_10 | AC | 739 ms
45,856 KB |
testcase_11 | AC | 759 ms
45,788 KB |
testcase_12 | AC | 92 ms
18,080 KB |
testcase_13 | WA | - |
testcase_14 | AC | 109 ms
18,428 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 398 ms
34,784 KB |
testcase_28 | AC | 807 ms
52,796 KB |
testcase_29 | AC | 232 ms
25,416 KB |
testcase_30 | AC | 555 ms
38,292 KB |
testcase_31 | AC | 542 ms
37,764 KB |
ソースコード
N,M = map(int,input().split()) e = [[] for _ in range(N)] from collections import defaultdict d = defaultdict(lambda:-1) for _ in range(M): a,b = map(int,input().split()) a -= 1 b -= 1 y = int(input()) if d[(a,b)] != -1: if d[(a,b)] != y: print(-1) exit() d[(a,b)] = y d[(b,a)] = y e[a].append(b) e[b].append(a) X = [-1]*N X[0] = 0 from collections import deque v = deque() v.append(0) while v: x = v.popleft() for ix in e[x]: if X[ix] == -1: X[ix] = X[x]^d[(x,ix)] v.append(ix) if X[ix] != -1: if X[ix] != X[x]^d[(x,ix)]: print(-1) exit() print(*X,sep='\n')