結果

問題 No.871 かえるのうた
ユーザー titiatitia
提出日時 2019-08-30 22:28:55
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 957 bytes
コンパイル時間 1,933 ms
コンパイル使用メモリ 199,952 KB
実行使用メモリ 5,764 KB
最終ジャッジ日時 2023-08-14 06:03:42
合計ジャッジ時間 6,031 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 153 ms
5,712 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 12 ms
4,380 KB
testcase_21 AC 53 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 WA -
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 10 ms
4,376 KB
testcase_27 WA -
testcase_28 WA -
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 52 ms
4,988 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 51 ms
4,976 KB
testcase_43 WA -
testcase_44 AC 1 ms
4,376 KB
testcase_45 AC 2 ms
4,376 KB
testcase_46 WA -
testcase_47 AC 1 ms
4,380 KB
testcase_48 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

signed 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];

    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