結果

問題 No.483 マッチ並べ
ユーザー compass19
提出日時 2017-02-16 23:14:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 518 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-30 01:24:11
合計ジャッジ時間 3,754 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
node2con = dict()
con_num = 0
clear = True
for _ in range(n):
    r0, c0, r1, c1 = map(int, input().split())
    if not clear: continue
    is_0 = (r0, c0) in node2con
    is_1 = (r1, c1) in node2con
    if is_0 and is_1:
        clear = False
    elif is_0 and not is_1:
        node2con[r1, c1] = node2con[r0, c0]
    elif is_1 and not is_0:
        node2con[r0, c0] = node2con[r1, c1]
    else:
        node2con[r0, c0] = node2con[r1, c1] = con_num
        con_num += 1
print(['NO', 'YES'][clear])
0