結果
| 問題 |
No.871 かえるのうた
|
| コンテスト | |
| ユーザー |
toyuzuko
|
| 提出日時 | 2020-05-09 09:51:39 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 593 bytes |
| コンパイル時間 | 519 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 28,448 KB |
| 最終ジャッジ日時 | 2024-07-05 06:04:02 |
| 合計ジャッジ時間 | 6,046 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 WA * 28 |
ソースコード
N, K = map(int, input().split())
X = list(map(int, input().split()))
A = list(map(int, input().split()))
lt = X[K - 1] - A[K - 1]
rt = X[K - 1] + A[K - 1]
lidx = K - 1
ridx = K - 1
while True:
update = False
if lidx > 0 and X[lidx - 1] >= lt:
lidx -= 1
lt = min(lt, X[lidx] - A[lidx])
rt = max(rt, X[lidx] - A[lidx])
update = True
if ridx < N - 1 and X[ridx + 1] <= rt:
ridx += 1
lt = min(lt, X[ridx] - A[ridx])
rt = max(rt, X[ridx] - A[ridx])
update = True
if not update:
break
print(ridx - lidx + 1)
toyuzuko