結果
問題 | No.2277 Honest or Dishonest ? |
ユーザー | ntuda |
提出日時 | 2023-04-23 10:31:49 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 551 bytes |
コンパイル時間 | 498 ms |
コンパイル使用メモリ | 82,232 KB |
実行使用メモリ | 108,092 KB |
最終ジャッジ日時 | 2024-04-25 19:16:47 |
合計ジャッジ時間 | 11,642 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 33 ms
52,624 KB |
testcase_01 | AC | 32 ms
52,524 KB |
testcase_02 | AC | 33 ms
53,948 KB |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | AC | 134 ms
86,932 KB |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | AC | 119 ms
86,152 KB |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | AC | 129 ms
89,456 KB |
testcase_15 | AC | 122 ms
85,304 KB |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | AC | 94 ms
79,104 KB |
testcase_27 | RE | - |
testcase_28 | AC | 143 ms
86,244 KB |
testcase_29 | AC | 171 ms
90,232 KB |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | AC | 153 ms
88,536 KB |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | AC | 85 ms
79,916 KB |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | AC | 88 ms
78,216 KB |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | RE | - |
testcase_45 | RE | - |
testcase_46 | RE | - |
testcase_47 | RE | - |
testcase_48 | RE | - |
testcase_49 | RE | - |
testcase_50 | RE | - |
testcase_51 | RE | - |
testcase_52 | RE | - |
ソースコード
MOD = 998244353 N, Q = map(int, input().split()) ABC = [list(map(int, input().split())) for _ in range(Q)] E = [[] for _ in range(N)] for a, b, c in ABC: E[a - 1].append((b - 1, c)) E[b - 1].append((a - 1, c)) C = [-1] * N def dfs(x): for y, c in E[x]: if C[y] == -1: C[y] = C[x] ^ c dfs(y) else: if C[y] != C[x] ^ c: print(0) exit() cnt = 0 for i in range(N): if C[i] == -1: C[i] = 0 cnt += 1 dfs(i) print(pow(2, cnt, MOD))