結果

問題 No.274 The Wall
ユーザー titia
提出日時 2022-09-13 02:40:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 73,648 KB
最終ジャッジ日時 2025-03-17 19:11:39
合計ジャッジ時間 3,035 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=[0]*M

for i in range(N):
    l,r=map(int,input().split())

    for j in range(l,r+1):
        A[min(j,M-1-j)]+=1

if M%2==0:
    if max(A)<=2:
        print("YES")
    else:
        print("NO")

else:
    if max(A)<=2 and A[M//2]<=1:
        print("YES")
    else:
        print("NO")

    
0