結果
問題 |
No.2073 Concon Substrings (Swap Version)
|
ユーザー |
|
提出日時 | 2023-07-13 19:19:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 742 bytes |
コンパイル時間 | 870 ms |
コンパイル使用メモリ | 114,256 KB |
最終ジャッジ日時 | 2025-02-15 10:14:56 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 17 WA * 20 |
ソースコード
#include<iostream> #include<set> #include<algorithm> #include<vector> #include<string> #include<set> #include<map> #include<numeric> #include<queue> #include<cmath> #include <unordered_set> using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair<ll,ll> P; typedef pair<int,P> PP; const ll MOD=1e9+7; int main(){ int N; cin>>N; string S; cin>>S; vector<map<char,int>> mp(3); for(int i=0;i<3*N;i++){ mp[i%3][S[i]]++; } int ans=0; for(int i=0;i<3;i++){ //min({mp[0]['c'],mp[1]['o'],mp[2]['n']}) //ans=max(ans,min({mp[i]['c'],mp[(i+1)%3]['o'],mp[(i+2)%3]['n']})); ans+=min({mp[i]['c'],mp[(i+1)%3]['o'],mp[(i+2)%3]['n']}); } cout<<ans<<endl; }