結果

問題 No.871 かえるのうた
ユーザー titiatitia
提出日時 2019-08-30 22:13:08
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 946 bytes
コンパイル時間 2,112 ms
コンパイル使用メモリ 198,308 KB
実行使用メモリ 5,388 KB
最終ジャッジ日時 2023-08-14 05:33:41
合計ジャッジ時間 6,216 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 149 ms
5,360 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 12 ms
4,376 KB
testcase_21 AC 52 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 WA -
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 9 ms
4,380 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,380 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 48 ms
4,708 KB
testcase_41 AC 1 ms
4,376 KB
testcase_42 AC 49 ms
4,644 KB
testcase_43 AC 1 ms
4,376 KB
testcase_44 AC 2 ms
4,384 KB
testcase_45 AC 3 ms
4,380 KB
testcase_46 AC 1 ms
4,376 KB
testcase_47 AC 1 ms
4,380 KB
testcase_48 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    int K;
    cin>>N>>K;
    K-=1;

    long long X[N];
    long long A[N];

    for (int i=0;i<N;i+=1){
        cin>>X[i];
    }
    for (int i=0;i<N;i+=1){
        cin>>A[i];
    }

    long long PLUS=X[K]+A[K];
    long long MINUS=X[K]-A[K];
    int ANS[N];
    ANS[K]=1;

    for (int roop=0;roop<100;roop+=1){

        for (int i=0;i<N;i+=1){
            if (X[i]<=PLUS && X[i]>=MINUS){
                ANS[i]=1;
                PLUS=max(PLUS,X[i]+A[i]);
                MINUS=min(MINUS,X[i]-A[i]);
            }
        }

        for (int i=N-1;i>=0;i-=1){
            if (X[i]<=PLUS && X[i]>=MINUS){
                ANS[i]=1;
                PLUS=max(PLUS,X[i]+A[i]);
                MINUS=min(MINUS,X[i]-A[i]);
            }
        }

    }
    int AW=0;
    for (int i=0;i<N;i+=1){
        if (ANS[i]==1){
            AW+=1;
        }
    }

    cout<<AW<<endl;
}
0