結果
| 問題 | No.871 かえるのうた |
| コンテスト | |
| ユーザー |
toyuzuko
|
| 提出日時 | 2020-05-09 09:51:39 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 593 bytes |
| 記録 | |
| コンパイル時間 | 490 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 31,748 KB |
| 最終ジャッジ日時 | 2026-03-26 12:58:11 |
| 合計ジャッジ時間 | 8,923 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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