結果
| 問題 | No.2073 Concon Substrings (Swap Version) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-09-16 21:41:14 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 567 bytes | 
| コンパイル時間 | 1,956 ms | 
| コンパイル使用メモリ | 172,344 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-12-21 18:47:23 | 
| 合計ジャッジ時間 | 3,946 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 31 WA * 6 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    string s; cin >> s;
    vector<vector<int>> cnt(3, vector<int>(3));
    string sub = "con";
    for (int i = 0; i < 3 * n; i++) {
        for (int j = 0; j < 3; j++) {
            if (s[i] == sub[j]) {
                cnt[(i + 3 - j) % 3][j]++;
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < 3; i++) {
        ans += *min_element(cnt[i].begin(), cnt[i].end());
    }
    cout << min(ans, n - 1);
}
            
            
            
        