結果

問題 No.1535 五七五
ユーザー logxlogx
提出日時 2021-05-21 01:11:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 72,356 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 22:10:31
合計ジャッジ時間 3,996 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 56 ms
6,940 KB
testcase_05 AC 147 ms
6,944 KB
testcase_06 AC 147 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 109 ms
6,940 KB
testcase_19 AC 109 ms
6,940 KB
testcase_20 AC 110 ms
6,944 KB
testcase_21 AC 112 ms
6,944 KB
testcase_22 AC 112 ms
6,940 KB
testcase_23 AC 111 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>

int main(){
    int n,a,b,c;std::cin >> n >> a >> b >> c;
    int wa[n+4]={};
    wa[n+1]=1e7,wa[n+2]=2e7,wa[n+3]=3e7;
    {
        int idx=0;
        std::string s;
        while(std::cin >> s){
            wa[idx+1]=wa[idx]+s.size();
            idx++;
        }
    }
    int i=0,j=0,k=0;
    int cnt=0;
    for(int l=0;l<n;l++){
        while(wa[i]-wa[l]<a)i++;
        while(wa[j]-wa[i]<b)j++;
        while(wa[k]-wa[j]<c)k++;
        if(wa[i]-wa[l]==a && wa[j]-wa[i]==b && wa[k]-wa[j]==c)cnt++;
    }
    std::cout << cnt << '\n';
}
0