結果

問題 No.274 The Wall
ユーザー compass19compass19
提出日時 2017-01-04 21:14:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 8,588 KB
最終ジャッジ日時 2023-08-22 18:55:13
合計ジャッジ時間 2,464 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,116 KB
testcase_01 AC 16 ms
8,144 KB
testcase_02 AC 16 ms
8,120 KB
testcase_03 AC 18 ms
8,272 KB
testcase_04 AC 16 ms
8,068 KB
testcase_05 AC 16 ms
7,804 KB
testcase_06 AC 16 ms
8,072 KB
testcase_07 AC 15 ms
7,816 KB
testcase_08 AC 15 ms
7,708 KB
testcase_09 AC 16 ms
8,260 KB
testcase_10 AC 16 ms
8,172 KB
testcase_11 AC 21 ms
8,400 KB
testcase_12 AC 22 ms
8,304 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 21 ms
8,456 KB
testcase_17 AC 21 ms
8,460 KB
testcase_18 AC 21 ms
8,360 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 22 ms
8,568 KB
testcase_23 AC 22 ms
8,372 KB
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

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