結果

問題 No.2910 単体ホモロジー入門
コンテスト
ユーザー detteiuu
提出日時 2024-10-04 21:39:06
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 757 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 132 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2026-04-20 14:39:05
合計ジャッジ時間 2,651 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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