結果
問題 |
No.2073 Concon Substrings (Swap Version)
|
ユーザー |
![]() |
提出日時 | 2022-09-16 21:31:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 539 bytes |
コンパイル時間 | 1,772 ms |
コンパイル使用メモリ | 172,444 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-21 18:27:56 |
合計ジャッジ時間 | 3,399 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 17 WA * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; const int INF = 1000000; int main(){ int N; cin >> N; string S; cin >> S; string T = "con"; vector<vector<int>> cnt(3, vector<int>(3, 0)); for (int i = 0; i < N * 3; i++){ for (int j = 0; j < 3; j++){ if (S[i] == T[j]){ int x = (i - j + 3) % 3; cnt[x][j]++; } } } int ans = 0; for (int i = 0; i < 3; i++){ int mn = INF; for (int j = 0; j < 3; j++){ mn = min(mn, cnt[i][j]); } ans += mn; } cout << ans << endl; }