結果
問題 | No.2674 k-Walk on Bipartite |
ユーザー | titia |
提出日時 | 2024-03-17 03:08:26 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,033 bytes |
コンパイル時間 | 299 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 105,304 KB |
最終ジャッジ日時 | 2024-03-17 03:08:34 |
合計ジャッジ時間 | 7,460 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 36 ms
53,460 KB |
testcase_01 | AC | 36 ms
53,460 KB |
testcase_02 | AC | 36 ms
53,460 KB |
testcase_03 | AC | 36 ms
53,460 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 37 ms
53,460 KB |
testcase_07 | AC | 225 ms
95,252 KB |
testcase_08 | AC | 259 ms
96,564 KB |
testcase_09 | WA | - |
testcase_10 | AC | 318 ms
101,348 KB |
testcase_11 | WA | - |
testcase_12 | AC | 305 ms
98,140 KB |
testcase_13 | WA | - |
testcase_14 | AC | 80 ms
84,216 KB |
testcase_15 | AC | 342 ms
103,908 KB |
testcase_16 | AC | 241 ms
98,236 KB |
testcase_17 | AC | 249 ms
95,756 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 160 ms
89,720 KB |
testcase_21 | AC | 287 ms
97,288 KB |
testcase_22 | WA | - |
testcase_23 | AC | 38 ms
53,460 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 36 ms
53,460 KB |
testcase_27 | WA | - |
testcase_28 | AC | 37 ms
53,460 KB |
testcase_29 | AC | 36 ms
53,460 KB |
testcase_30 | WA | - |
testcase_31 | AC | 36 ms
53,460 KB |
testcase_32 | AC | 37 ms
53,460 KB |
testcase_33 | AC | 37 ms
53,460 KB |
testcase_34 | AC | 37 ms
53,460 KB |
testcase_35 | AC | 38 ms
53,460 KB |
testcase_36 | AC | 41 ms
53,460 KB |
testcase_37 | AC | 36 ms
53,460 KB |
testcase_38 | AC | 38 ms
53,460 KB |
ソースコード
import sys input = sys.stdin.readline N,M=map(int,input().split()) s,t,k=map(int,input().split()) s-=1 t-=1 E=[[] for i in range(N)] for i in range(M): u,v=map(int,input().split()) u-=1 v-=1 E[u].append(v) E[v].append(u) DIS=[-1]*N Q=[s] DIS[s]=0 LIST=[] while Q: x=Q.pop() LIST.append(x) for to in E[x]: if DIS[to]==-1: DIS[to]=DIS[x]+1 Q.append(to) if 0<=DIS[t]<=k: if (DIS[t]-k)%2==0: print("Yes") else: print("No") exit() if DIS[t]>k: if (DIS[t]-k)%2==0: print("Unknown") else: print("No") exit() DIS=[-1]*N Q=[t] DIS[t]=0 LIST2=[] while Q: x=Q.pop() LIST2.append(x) for to in E[x]: if DIS[to]==-1: DIS[to]=DIS[x]+1 Q.append(to) ELIST=0 for x in LIST: ELIST+=len(E[x]) ELIST2=0 for x in LIST2: ELIST2+=len(E[x]) if ELIST==len(LIST)*(len(LIST)-1): print("No") elif ELIST2==len(LIST2)*(len(LIST2)-1): print("No") else: print("Yes")