結果
| 問題 |
No.871 かえるのうた
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-06-11 22:20:31 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 229 ms / 2,000 ms |
| コード長 | 499 bytes |
| コンパイル時間 | 441 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 28,180 KB |
| 最終ジャッジ日時 | 2024-11-30 10:42:45 |
| 合計ジャッジ時間 | 5,147 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 49 |
ソースコード
n, k = map(int, input().split())
x = [0] + [int(i) for i in input().split()]
a = [0] + [int(i) for i in input().split()]
l = r = k
ld, rd = x[k]-a[k], x[k]+a[k]
update = True
while update:
update = False
while l-1 >= 1 and ld <= x[l-1]:
update = True
l -= 1
ld = min(ld, x[l]-a[l])
rd = max(rd, x[l]+a[l])
while r+1 <= n and x[r+1] <= rd:
update = True
r += 1
rd = max(rd, x[r]+a[r])
ld = min(ld, x[r]-a[r])
print(r-l+1)