結果

問題 No.870 無敵囲い
コンテスト
ユーザー hal9009
提出日時 2020-11-19 21:10:57
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 594 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 340 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 15,356 KB
最終ジャッジ日時 2026-03-18 17:05:11
合計ジャッジ時間 3,066 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 12 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def isContain(goal,s):
    ans = 'YES'
    for v in goal:
        if v not in s:
            ans = 'NO'
    return ans

n = int(input())
xy1 = []
xy2 = []
goal = [[2, 8], [3, 9], [7, 9]]

for i in range(n):
    xi1, yi1, xi2, yi2 = map(int, input().split())
    xy1.append([xi1, yi1])
    xy2.append([xi2, yi2])

ans = 'NO'

s = [xy1[i] for i in range(n)]
s.sort()
ans = isContain(goal, s)
if ans == 'YES':
    print(ans)
else:
    for i in range(n):
        s[s.index(xy1[i])] = xy2[i]
        s.sort()
        ans = isContain(goal, s)
        if ans == 'YES':
            break
    print(ans)
0