結果

問題 No.2910 単体ホモロジー入門
コンテスト
ユーザー detteiuu
提出日時 2024-10-04 21:39:06
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 35 ms / 2,000 ms
+ 516µs
コード長 757 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 107 ms
コンパイル使用メモリ 64,292 KB
実行使用メモリ 53,780 KB
最終ジャッジ日時 2026-11-11 04:01:54
合計ジャッジ時間 4,133 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

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