結果
| 問題 |
No.2073 Concon Substrings (Swap Version)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-16 21:37:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 558 bytes |
| コンパイル時間 | 1,596 ms |
| コンパイル使用メモリ | 171,612 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-21 18:39:33 |
| 合計ジャッジ時間 | 3,163 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 17 WA * 20 |
ソースコード
#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 < s.size(); 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 << ans;
}