結果

問題 No.274 The Wall
ユーザー lloyzlloyz
提出日時 2023-09-19 01:09:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 676 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 78,276 KB
最終ジャッジ日時 2023-09-19 01:09:11
合計ジャッジ時間 5,681 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,516 KB
testcase_01 AC 75 ms
75,220 KB
testcase_02 AC 76 ms
74,832 KB
testcase_03 AC 100 ms
76,768 KB
testcase_04 AC 72 ms
71,272 KB
testcase_05 AC 73 ms
71,328 KB
testcase_06 AC 73 ms
71,224 KB
testcase_07 AC 72 ms
71,312 KB
testcase_08 AC 74 ms
71,360 KB
testcase_09 AC 73 ms
71,264 KB
testcase_10 AC 79 ms
75,820 KB
testcase_11 AC 103 ms
77,088 KB
testcase_12 AC 111 ms
78,032 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 111 ms
77,780 KB
testcase_17 AC 105 ms
77,920 KB
testcase_18 AC 107 ms
77,728 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 108 ms
77,692 KB
testcase_23 AC 108 ms
77,876 KB
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(n)]

LR.sort(key=lambda x: (-(x[1] - x[0]), x[0]))
DP = [0 for _ in range(m)]
for i in range(n):
    l, r = LR[i]
    flag = True
    for j in range(l, r + 1):
        if DP[j]:
            flag = False
            break
    if flag:
        for j in range(l, r + 1):
            DP[j] = 1
        continue
    l, r = m - 1 - r, m - 1 - l
    flag = True
    for j in range(l, r + 1):
        if DP[j]:
            flag = False
            break
    if flag:
        for j in range(l, r + 1):
            DP[j] = 1
        continue
    else:
        print("NO")
        exit()
print("YES")
0