結果

問題 No.1535 五七五
ユーザー logxlogx
提出日時 2021-05-21 01:09:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 563 ms
コンパイル使用メモリ 70,692 KB
実行使用メモリ 5,612 KB
最終ジャッジ日時 2023-08-03 23:30:34
合計ジャッジ時間 3,055 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 60 ms
5,292 KB
testcase_05 AC 141 ms
5,332 KB
testcase_06 AC 143 ms
5,340 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 111 ms
5,612 KB
testcase_19 AC 110 ms
5,280 KB
testcase_20 AC 111 ms
5,280 KB
testcase_21 AC 112 ms
5,352 KB
testcase_22 AC 111 ms
5,340 KB
testcase_23 AC 111 ms
5,552 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