結果
問題 |
No.2073 Concon Substrings (Swap Version)
|
ユーザー |
|
提出日時 | 2022-10-22 04:27:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 615 bytes |
コンパイル時間 | 1,955 ms |
コンパイル使用メモリ | 193,160 KB |
最終ジャッジ日時 | 2025-02-08 10:57:25 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 17 WA * 20 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; using ll = long long; using ld = long double; int main(){ cin.tie(0); ios::sync_with_stdio(0); struct con { int c=0, o=0, n=0; }; int N; string S; cin >> N >> S; con x[3]; rep(i,N)rep(j,3) { if(S[i * 3 + j] == 'c') x[j].c++; if(S[i * 3 + j] == 'o') x[j].o++; if(S[i * 3 + j] == 'n') x[j].n++; } int ans = 0; ans += min({x[0].c, x[1].o, x[2].n}); ans += min({x[1].c, x[2].o, x[0].n}); ans += min({x[2].c, x[0].o, x[1].n}); cout << ans << endl; }