結果
問題 | No.2073 Concon Substrings (Swap Version) |
ユーザー | |
提出日時 | 2022-09-16 23:19:44 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 3,013 bytes |
コンパイル時間 | 1,070 ms |
コンパイル使用メモリ | 100,232 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-01 14:07:43 |
合計ジャッジ時間 | 2,457 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,940 KB |
testcase_03 | AC | 2 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 16 ms
6,940 KB |
testcase_06 | AC | 16 ms
6,944 KB |
testcase_07 | AC | 2 ms
6,948 KB |
testcase_08 | AC | 11 ms
6,940 KB |
testcase_09 | AC | 13 ms
6,944 KB |
testcase_10 | AC | 21 ms
6,940 KB |
testcase_11 | AC | 20 ms
6,940 KB |
testcase_12 | AC | 2 ms
6,940 KB |
testcase_13 | AC | 4 ms
6,944 KB |
testcase_14 | AC | 18 ms
6,940 KB |
testcase_15 | AC | 7 ms
6,944 KB |
testcase_16 | AC | 16 ms
6,944 KB |
testcase_17 | AC | 2 ms
6,940 KB |
testcase_18 | AC | 3 ms
6,940 KB |
testcase_19 | AC | 15 ms
6,940 KB |
testcase_20 | AC | 12 ms
6,940 KB |
testcase_21 | AC | 10 ms
6,940 KB |
testcase_22 | AC | 16 ms
6,940 KB |
testcase_23 | AC | 2 ms
6,940 KB |
testcase_24 | AC | 3 ms
6,944 KB |
testcase_25 | AC | 11 ms
6,940 KB |
testcase_26 | AC | 16 ms
6,944 KB |
testcase_27 | AC | 3 ms
6,944 KB |
testcase_28 | AC | 13 ms
6,940 KB |
testcase_29 | AC | 6 ms
6,940 KB |
testcase_30 | AC | 12 ms
6,940 KB |
testcase_31 | AC | 6 ms
6,944 KB |
testcase_32 | AC | 4 ms
6,940 KB |
testcase_33 | AC | 5 ms
6,940 KB |
testcase_34 | AC | 4 ms
6,944 KB |
testcase_35 | AC | 9 ms
6,944 KB |
testcase_36 | AC | 5 ms
6,940 KB |
testcase_37 | AC | 9 ms
6,944 KB |
testcase_38 | AC | 4 ms
6,944 KB |
testcase_39 | AC | 10 ms
6,944 KB |
testcase_40 | AC | 9 ms
6,940 KB |
testcase_41 | AC | 10 ms
6,940 KB |
ソースコード
#include <cstdio> #include <cstdint> #include <cmath> #include <cstring> #include <iostream> #include <iomanip> #include <vector> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <queue> #include <algorithm> #include <numeric> #include <cassert> using namespace std; namespace atcoder{};using namespace atcoder; using ull = uint64_t; using ll = int64_t; using vi = vector<int>; using vll = vector<ll>; using vs = vector<string>; using ld = long double; using P = pair<ll,ll>; using G = vector<vector<int>>; #ifdef MYDEBUG #define LO(...) fprintf(stderr, __VA_ARGS__) #define debug(x) cerr << "\033[33m(line:" << __LINE__ << ") " << #x << ": " << x << "\033[m" << endl #else #define LO(...) (void)0 #define debug(x) (void)0 #endif #define reps(i,a,n) for(ll i##_len = (ll)(n), i = (a); i < i##_len; ++i) #define rep(i,n) reps(i,0,n) #define rrep(i,n) reps(i,1,n+1) #define repd(i,n) for(ll i=n-1;i>=0;i--) #define rrepd(i,n) for(ll i=n;i>=1;i--) #define inp(i) ll i; cin >> i; #define inps(s) string s; cin >> s; #define inpp(p) cin >> (p).first >> (p).second; #define inpv(v,N) vll v(N);rep(i,N)cin>>v[i]; #define inpg(g,N,M) g.resize(N);rep(i,M){inp(a);inp(b);a--,b--;g[a].push_back(b);g[b].push_back(a);} #define all(v) begin(v),end(v) #define YESNO(bool) if(bool){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;} #define yesno(bool) if(bool){cout<<"yes"<<endl;}else{cout<<"no"<<endl;} #define YesNo(bool) if(bool){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;} #define YES cout<<"YES"<<endl #define NO cout<<"NO"<<endl #define yes cout<<"yes"<<endl #define no cout<<"no"<<endl #define Yes cout<<"Yes"<<endl #define No cout<<"No"<<endl #define SP cout << " "; #define ENDL cout << "\n"; #define outp(i) cout << (i); #define outps(i) cout << (i) << " "; #define outpl(i) cout << (i) << "\n"; #define setfp() cout << fixed << setprecision(16) template<typename C> void outpv(C &v){for(auto &&e:v){cout << e;if(&e != &v.back()) cout << ' ';}cout << "\n";} template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } inline ll lg(ll __n) { return sizeof(ll) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; int main(){ inp(N); inps(S); ll n = S.size(); ll cou[3][3] = {}; rep(i,n){ if(S[i] == 'c'){ cou[i%3][0]++; } if(S[i] == 'o'){ cou[i%3][1]++; } if(S[i] == 'n'){ cou[i%3][2]++; } } LO("ch:%ld %ld %ld\n",cou[0][0],cou[1][1],cou[2][2]); ll f = min({cou[0][0],cou[1][1],cou[2][2]}); ll t = N-f-1; ll f2 = min(max<ll>(t,0),min({cou[0][1],cou[1][2],cou[2][0]})); LO("f=%ld f2=%ld t=%ld\n", f,f2,t); ll t3 = N-f-1; if(f2)t3-=f2; LO("t3:%ld\n", t3); ll f3 = min({max<ll>(0,t3),cou[0][2],cou[1][0],cou[2][1]}); LO("f3:%ld\n", f3); outpl(f + f2 + f3); return 0; }