結果

問題 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
コンパイル時間 100 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-05-10 00:41:59
合計ジャッジ時間 2,144 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 33 ms
10,752 KB
testcase_02 AC 33 ms
10,752 KB
testcase_03 AC 34 ms
10,880 KB
testcase_04 AC 32 ms
10,880 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 31 ms
10,752 KB
testcase_10 AC 30 ms
10,880 KB
testcase_11 AC 38 ms
11,008 KB
testcase_12 AC 39 ms
11,136 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 37 ms
11,136 KB
testcase_17 AC 37 ms
11,008 KB
testcase_18 AC 37 ms
11,008 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 39 ms
11,008 KB
testcase_23 AC 38 ms
11,008 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