結果

問題 No.871 かえるのうた
ユーザー E31415926E31415926
提出日時 2019-08-30 22:40:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 870 bytes
コンパイル時間 4,026 ms
コンパイル使用メモリ 162,924 KB
実行使用メモリ 5,024 KB
最終ジャッジ日時 2023-08-14 06:29:07
合計ジャッジ時間 5,235 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 3 ms
4,384 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 13 ms
4,384 KB
testcase_13 AC 4 ms
4,384 KB
testcase_14 AC 101 ms
4,812 KB
testcase_15 AC 103 ms
5,024 KB
testcase_16 AC 108 ms
4,888 KB
testcase_17 AC 91 ms
4,804 KB
testcase_18 AC 16 ms
4,380 KB
testcase_19 WA -
testcase_20 AC 9 ms
4,384 KB
testcase_21 AC 40 ms
4,384 KB
testcase_22 AC 2 ms
4,384 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,384 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 6 ms
4,384 KB
testcase_27 AC 9 ms
4,384 KB
testcase_28 AC 1 ms
4,384 KB
testcase_29 AC 32 ms
4,384 KB
testcase_30 AC 57 ms
4,552 KB
testcase_31 AC 3 ms
4,384 KB
testcase_32 AC 47 ms
4,396 KB
testcase_33 WA -
testcase_34 AC 18 ms
4,384 KB
testcase_35 AC 46 ms
4,380 KB
testcase_36 AC 63 ms
4,604 KB
testcase_37 AC 39 ms
4,380 KB
testcase_38 AC 91 ms
4,732 KB
testcase_39 WA -
testcase_40 AC 26 ms
4,460 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 27 ms
4,380 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 2 ms
4,384 KB
testcase_47 AC 2 ms
4,384 KB
testcase_48 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int N, K;
int X[100100];
int A[100100];

signed main() {
    cin >> N >> K;
    --K;
    rep(i, N) {
        cin >> X[i];
    }
    rep(i, N) {
        cin >> A[i];
    }
    int ans = 1;
    //左方向
    int leftest = X[K] - A[K];
    for (int i = K - 1; i >= 0; --i) {
        if (leftest <= X[i]) {
            ans++;
            leftest = min(leftest, X[i] - A[i]);
        } else break;
    }
    //右方向
    int rightest = X[K] + A[K];
    for (int i = K + 1; i < N; ++i) {
        if (X[i] <= rightest) {
            ans++;
            rightest = max(rightest, X[i] + A[i]);
        } else break;
    }
    cout << ans << endl;
    return 0;
}
0