結果
| 問題 |
No.274 The Wall
|
| コンテスト | |
| ユーザー |
chocorusk
|
| 提出日時 | 2020-09-19 23:05:16 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 591 bytes |
| コンパイル時間 | 546 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2025-03-17 19:07:50 |
| 合計ジャッジ時間 | 2,401 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines
n, m=map(int, readline().split())
lr=list(map(int, read().split()))
ls=lr[::2]
rs=lr[1::2]
for i in range(n):
if m-1-rs[i]<ls[i]:
ls[i], rs[i]=m-1-rs[i], m-1-ls[i]
lrs=sorted(list(zip(ls, rs)))
x1, x2=-1, -1
for l, r in lrs:
if x1<l and x2<l:
if x1<x2:
x2=r
else:
x1=r
elif x1<l:
x1=r
elif x2<l:
x2=r
else:
print("NO")
exit()
if x1+x2+2<=m:
print("YES")
else:
print("NO")
chocorusk