結果

問題 No.1023 Cyclic Tour
ユーザー chineristACchineristAC
提出日時 2020-10-08 16:39:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 140,808 KB
最終ジャッジ日時 2023-09-27 11:52:00
合計ジャッジ時間 20,541 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,192 KB
testcase_01 AC 64 ms
71,308 KB
testcase_02 AC 65 ms
71,196 KB
testcase_03 AC 64 ms
71,276 KB
testcase_04 AC 217 ms
88,940 KB
testcase_05 AC 204 ms
88,672 KB
testcase_06 AC 214 ms
89,284 KB
testcase_07 AC 246 ms
91,164 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 194 ms
87,112 KB
testcase_12 AC 187 ms
86,760 KB
testcase_13 AC 182 ms
84,984 KB
testcase_14 WA -
testcase_15 AC 186 ms
86,512 KB
testcase_16 AC 261 ms
88,376 KB
testcase_17 AC 263 ms
88,224 KB
testcase_18 AC 302 ms
88,296 KB
testcase_19 AC 264 ms
87,596 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 259 ms
89,168 KB
testcase_23 WA -
testcase_24 AC 279 ms
89,220 KB
testcase_25 AC 284 ms
90,180 KB
testcase_26 AC 301 ms
90,808 KB
testcase_27 AC 268 ms
90,492 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 267 ms
89,548 KB
testcase_34 AC 266 ms
88,724 KB
testcase_35 AC 278 ms
90,292 KB
testcase_36 WA -
testcase_37 AC 275 ms
91,516 KB
testcase_38 WA -
testcase_39 AC 266 ms
89,248 KB
testcase_40 AC 265 ms
89,108 KB
testcase_41 WA -
testcase_42 AC 298 ms
90,256 KB
testcase_43 WA -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 WA -
testcase_49 AC 277 ms
94,336 KB
testcase_50 WA -
testcase_51 AC 283 ms
92,352 KB
testcase_52 AC 273 ms
92,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
edge = [[] for i in range(N)]
for i in range(M):
    a,b,c = map(int,input().split())
    edge[a-1].append(b-1)
    if c==1:
        edge[b-1].append(a-1)

used = [False]*N
used[0] = True
def dfs(v,pv):
    for nv in edge[v]:
        if used[nv]:
            if nv!=pv:
                exit(print("Yes"))
        else:
            used[nv] = True
            dfs(nv,v)

dfs(0,-1)
print("No")
0