結果
| 問題 | No.3426 Mod K Graph Increments (Hard) |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2026-01-18 03:00:44 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 814 bytes |
| 記録 | |
| コンパイル時間 | 379 ms |
| コンパイル使用メモリ | 82,708 KB |
| 実行使用メモリ | 131,040 KB |
| 最終ジャッジ日時 | 2026-01-18 03:00:47 |
| 合計ジャッジ時間 | 3,259 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 7 |
ソースコード
import sys
input = sys.stdin.readline
T=int(input())
for tests in range(T):
N,M,K=map(int,input().split())
E=[[] for i in range(N)]
for i in range(M):
x,y=map(int,input().split())
x-=1
y-=1
E[x].append(y)
E[y].append(x)
B=list(map(int,input().split()))
D=[-1]*N
flag=1
D[0]=0
Q=[0]
while Q:
x=Q.pop()
for to in E[x]:
if D[to]==-1:
D[to]=D[x]^1
Q.append(to)
else:
if D[to]==D[x]:
flag=0
break
if flag==0:
print("Yes")
continue
score=[0,0]
for i in range(N):
score[D[i]]+=B[i]
if score[0]==score[1]:
print("Yes")
else:
print("No")
titia