結果

問題 No.2910 単体ホモロジー入門
ユーザー titia
提出日時 2024-10-04 22:00:43
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 756 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 82,172 KB
実行使用メモリ 77,808 KB
最終ジャッジ日時 2024-10-04 22:01:07
合計ジャッジ時間 18,243 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31 RE * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from random import choice,randint

N,M=map(int,input().split())
E=[[] for i in range(N)]

for i in range(M):
    x,y=map(int,input().split())
    E[x].append(y)
    E[y].append(x)

X=list(map(int,input().split()))
X.sort()
X=tuple(X)

SET=set()

for i in range(10**5):
    A=[randint(0,N-1)]

    flag=0

    while flag<100:
        to=choice(E[A[-1]])

        if to==A[0] and len(A)>=3:
            SET.add(tuple(sorted(A)))
            break
        else:
            if to in A:
                flag+=1
                continue
            else:
                A.append(to)
                flag=0
                continue

SET.discard(X)

if len(SET)>0:
    print("Yes")
else:
    print("No")
            
    

0