結果

問題 No.274 The Wall
ユーザー compass19
提出日時 2017-01-04 21:14:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-12-17 19:39:51
合計ジャッジ時間 2,156 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
blocks = [ tuple(map(int, input().split())) for _ in range(n)]
blocks = sorted(blocks, key=lambda x: x[1])

pink_block = [True for _ in range(m)]
def update(l, r):
    if all(pink_block[l:r+1]):
        pink_block[l:r+1] = [False]*(r-l+1)
        return True
    return False

for l, r in blocks:
    if not update(l, r):
        l, r = m - r - 1, m - l - 1
        if not update(l, r):
            print('NO'); exit()
print('YES')
0