結果
| 問題 |
No.2076 Concon Substrings (ConVersion)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-16 23:08:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 808 bytes |
| コンパイル時間 | 1,741 ms |
| コンパイル使用メモリ | 173,640 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-21 22:39:20 |
| 合計ジャッジ時間 | 2,840 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 WA * 6 |
ソースコード
#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';
}