結果
| 問題 |
No.871 かえるのうた
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2019-08-30 21:24:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 632 bytes |
| コンパイル時間 | 1,586 ms |
| コンパイル使用メモリ | 168,532 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-21 21:50:47 |
| 合計ジャッジ時間 | 3,969 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 41 WA * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
int main() {
cin.tie(nullptr); ios::sync_with_stdio(false);
int n, k; cin >> n >> k, --k;
V<lint> x(n); for (auto&& e : x) cin >> e;
V<lint> a(n); for (auto&& e : a) cin >> e;
int res = -1;
lint t = x[k] + a[k];
for (int i = k; i < n; ++i) {
if (t < x[i]) break;
++res;
t = max(t, x[i] + a[i]);
}
t = x[k] - a[k];
for (int i = k; i >= 0; --i) {
if (x[i] < t) break;
++res;
t = min(t, x[i] - a[i]);
}
cout << res << '\n';
}
risujiroh