結果
| 問題 | No.3482 Quod Erat Demonstrandum |
| コンテスト | |
| ユーザー |
ゼット
|
| 提出日時 | 2026-03-27 22:30:03 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 600 bytes |
| 記録 | |
| コンパイル時間 | 194 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 126,888 KB |
| 最終ジャッジ日時 | 2026-03-27 22:30:40 |
| 合計ジャッジ時間 | 19,478 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 WA * 10 |
ソースコード
Q=int(input())
for _ in range(Q):
N,M=map(int,input().split())
G=[[] for i in range(N)]
for i in range(M):
a,b,c=map(int,input().split())
G[a-1].append((b-1,c))
G[b-1].append((a-1,c))
dist=[-1]*N
dist[0]=0
dp=[0]*N
from collections import deque
S=deque()
S.append(0)
while S:
x=S.popleft()
for B in G[x]:
y,c=B[:]
if dist[y]==-1:
dist[y]=dist[x]+1
dp[y]=dp[x]^(c-1)
S.append(y)
if dist[N-1]==-1:
print('Unknown')
else:
if dp[N-1]==0:
print('Same')
else:
print('Different')
print(dist[N-1])
ゼット