結果
| 問題 | No.1508 Avoid being hit |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-03-26 22:21:18 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 572 bytes |
| 記録 | |
| コンパイル時間 | 226 ms |
| コンパイル使用メモリ | 85,448 KB |
| 実行使用メモリ | 125,868 KB |
| 最終ジャッジ日時 | 2026-03-26 22:21:33 |
| 合計ジャッジ時間 | 6,958 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 17 |
ソースコード
n,Q=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
s=set()
x=[[1,n] for i in range(Q+1)]
for i in range(Q-1,-1,-1):
q,w=a[i],b[i]
s.add((i,q));s.add((i,w))
if x[i+1][0]==q and q+1==w:
x[i][0]=w
if x[i+1][1]==w and w-1==q:
x[i][1]=q
if x[0][0]>x[0][1]:
print("NO")
else:
print("YES")
m=x[0][0]
print(m)
for i in range(1,Q+1):
for j in range(-1,2):
if x[i][0]<=m+j<=x[i][1] and (i-1,m+j) not in s:
m+=j
break
print(m)