結果
問題 |
No.871 かえるのうた
|
ユーザー |
![]() |
提出日時 | 2019-09-03 02:38:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 663 bytes |
コンパイル時間 | 1,584 ms |
コンパイル使用メモリ | 167,656 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-21 10:42:17 |
合計ジャッジ時間 | 5,347 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,a) for(int i = 0; i < (a); i++) #define ALL(a) (a).begin(),(a).end() typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; const int MOD = 1e9 + 7; signed main(){ int n,k; cin >> n >> k; k--; ll x[n],a[n]; REP(i,n){ cin >> x[i]; } REP(i,n){ cin >> a[i]; } int ans = 1; for(int i = k; i < n - 1; i++){ if(x[i] + a[i] < x[i + 1]){ break; } ans++; } for(int i = k; i > 0; i--){ if(x[i] - a[i] > x[i - 1]){ break; } ans++; } cout << ans << endl; }