結果
| 問題 |
No.2073 Concon Substrings (Swap Version)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-16 22:51:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 953 bytes |
| コンパイル時間 | 1,788 ms |
| コンパイル使用メモリ | 198,708 KB |
| 最終ジャッジ日時 | 2025-02-07 10:23:22 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 25 WA * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef _RUTHEN
#include <debug.hpp>
#else
#define show(...) true
#endif
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
string S;
cin >> S;
bool ok = true;
rep(i, 3 * N) {
if (i % 3 == 0 and S[i] != 'c') ok = false;
if (i % 3 == 1 and S[i] != 'o') ok = false;
if (i % 3 == 2 and S[i] != 'n') ok = false;
}
if (ok) {
cout << N << '\n';
return 0;
}
V<V<int>> cnt(3, V<int>(26));
rep(i, 3 * N) cnt[i % 3][S[i] - 'a']++;
int ans = 0;
rep(i, 3) {
int r = min({cnt[(i + 0) % 3]['c' - 'a'], cnt[(i + 1) % 3]['o' - 'a'], cnt[(i + 2) % 3]['n' - 'a']});
show(r);
if (i > 0) r = min(r, N - 1);
ans += r;
}
cout << ans << '\n';
return 0;
}