結果

問題 No.2076 Concon Substrings (ConVersion)
ユーザー t98slidert98slider
提出日時 2022-09-16 23:08:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 808 bytes
コンパイル時間 1,528 ms
コンパイル使用メモリ 171,572 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-23 16:33:37
合計ジャッジ時間 3,632 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 8 ms
4,376 KB
testcase_08 AC 7 ms
4,380 KB
testcase_09 AC 8 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 4 ms
4,380 KB
testcase_18 AC 5 ms
4,376 KB
testcase_19 WA -
testcase_20 AC 4 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 WA -
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 WA -
testcase_29 AC 3 ms
4,376 KB
testcase_30 AC 3 ms
4,380 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    vector<int> p;
    multiset<int> S;
    for(int i = 0; i + 3 <= n; i++){
        if(s.substr(i, 3) != "con")continue;
        int cnt = 0;
        while(i + 3 <= n && s.substr(i, 3) == "con"){
            cnt++;
            i += 3;
        }
        p.push_back(cnt);
        S.insert(cnt);
    }
    S.insert(n + 2);
    int ans = 0;
    for(int i = 0; i < 10000; i++){
        int v = *S.lower_bound(a);
        if(v == n + 2)break;
        ans++;
        S.erase(S.find(v));
        S.insert(v - a);
        v = *S.lower_bound(b);
        if(v == n + 2)break;
        ans++;
        S.erase(S.find(v));
        S.insert(v - b);
    }
    cout << ans << '\n';
}
0