結果

問題 No.2910 単体ホモロジー入門
ユーザー detteiuu
提出日時 2024-10-04 21:39:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 757 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 82,108 KB
実行使用メモリ 54,288 KB
最終ジャッジ日時 2024-10-04 21:39:09
合計ジャッジ時間 2,945 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations

N, M = map(int, input().split())
edge = set()
for _ in range(M):
    u, v = map(int, input().split())
    edge.add((u, v))
    edge.add((v, u))
abc = tuple(sorted(map(int, input().split())))

if N <= 2:
    exit(print("No"))

for comb in combinations(range(4), 3):
    if comb == abc:
        continue
    a, b, c = comb
    if (a, b) in edge and (b, c) in edge and (c, a) in edge:
        print("Yes")
        break
else:
    if ((0, 1) in edge and (1, 2) in edge and (2, 3) in edge and (3, 0) in edge or
        (0, 2) in edge and (2, 1) in edge and (1, 3) in edge and (3, 0) in edge or
        (0, 2) in edge and (2, 3) in edge and (3, 1) in edge and (1, 0) in edge):
        print("Yes")
    else:
        print("No")
0