結果
| 問題 |
No.871 かえるのうた
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-26 00:44:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 935 bytes |
| コンパイル時間 | 933 ms |
| コンパイル使用メモリ | 85,976 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 11:44:34 |
| 合計ジャッジ時間 | 5,296 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 WA * 22 |
ソースコード
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
typedef pair<pair<int, int>, int> PP;
const ll INF = 1e15;
const int MAX = 510000;
const ll MOD = 1000000007;
int main(void) {
int N, K; cin >> N >> K; K--;
vector<ll> X(N), A(N);
for (int i = 0; i < N; i++) cin >> X[i];
for (int i = 0; i < N; i++) cin >> A[i];
int l, r, lX, rX;
bool update = true;
l = r = K;
lX = X[K] - A[K]; rX = X[K] + A[K];
while (update) {
update = false;
while (r < N && X[r] <= rX) {
if (rX < X[r] + A[r]) {
rX = X[r] + A[r];
update = true;
}
r++;
}
while (0 <= l && lX <= X[l]) {
if (X[l] - A[l] < lX) {
lX = X[l] - A[l];
update = true;
}
l--;
}
}
cout << r - l - 1 << endl;
}