結果
問題 | No.871 かえるのうた |
ユーザー |
![]() |
提出日時 | 2024-04-09 10:15:41 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 243 ms / 2,000 ms |
コード長 | 338 bytes |
コンパイル時間 | 127 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 28,908 KB |
最終ジャッジ日時 | 2024-10-01 17:10:54 |
合計ジャッジ時間 | 5,433 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 49 |
ソースコード
N,K=map(int,input().split())K-=1X=list(map(int,input().split()))A=list(map(int,input().split()))l=Kr=K+1mi,ma=X[K]-A[K],X[K]+A[K]+1while l and mi<=X[l-1] or r<N and X[r]<ma:if l and mi<=X[l-1]:l-=1mi=min(mi,X[l]-A[l])ma=max(ma,X[l]+A[l]+1)else:mi=min(mi,X[r]-A[r])ma=max(ma,X[r]+A[r]+1)r+=1ans=r-lprint(ans)