結果
問題 |
No.2073 Concon Substrings (Swap Version)
|
ユーザー |
![]() |
提出日時 | 2022-09-16 22:26:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,003 bytes |
コンパイル時間 | 1,915 ms |
コンパイル使用メモリ | 207,216 KB |
最終ジャッジ日時 | 2025-02-07 10:02:11 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 17 WA * 20 |
ソースコード
#include <bits/stdc++.h> #define all(x) begin(x), end(x) using namespace std; using i32 = int; using i64 = long long; using ld = long double; template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {return a < b and (a = b, true);} template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {return a > b and (a = b, true);} const i64 supl = LONG_LONG_MAX / 2 - 100; const i32 supi = INT_MAX / 2 - 100; void main_() { i32 n; cin >> n; string s; cin >> s; vector info(3, map<char, i32>()); for (i32 i = 0 ; i < 3 * n ; i++) { info[i % 3][s[i]]++; } // for (auto [x, y] : info[0]) cout << x << ' ' << y << endl; i32 ans = 0; ans += min({ info[0]['c'], info[1]['o'], info[2]['n'] }); ans += min({ info[1]['c'], info[2]['o'], info[0]['n'] }); ans += min({ info[2]['c'], info[0]['o'], info[1]['n'] }); cout << ans << endl; } int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); main_(); return 0; }