Submission #19560281
Source Code Expand
Copy
#include <bits/stdc++.h> #include <unordered_map> using namespace std; template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; } void dbg_out() { cerr << endl; } template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); } #ifdef WA_DEBUG #define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__) #else #define dbg(...) #endif using ll = long long; using vi = vector<int>; using ull = unsigned long long; #define pb push_back #define fi first #define se second #define rep(i,a,b) for(int i=int(a);i<=(int)(b);i++) #define per(i,a,b) for(int i=int(a);i>=(int)(b);i--) const int mod = 1e9+7; const int inf = 0x3f3f3f3f; const int maxn = 1e5+10; int main() { #ifndef WA_DEBUG ios::sync_with_stdio(false);cin.tie(nullptr); #endif int n; cin>>n; string s; ll ans=1e10; cin>>s; if(n==1) { if(s[0]=='1') cout<<ans*2<<'\n'; else cout<<ans<<'\n'; return 0; } rep(i,0,2) { int now=i; bool f=true; for(char c:s) { char tmp; if(now==0) tmp='1'; if(now==1) tmp='0'; if(now==2) tmp='1'; if(tmp!=c) { f=false; break; } now=(now+1)%3; } if(f) { int len=i+n; len=len/3+(!!(len%3)); ans=ans-len+1; } } cout<<ans<<'\n'; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Many 110 |
User | WA_King |
Language | C++ (GCC 9.2.1) |
Score | 0 |
Code Size | 1898 Byte |
Status | WA |
Exec Time | 6 ms |
Memory | 3744 KB |
Judge Result
Set Name | All | Sample | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 400 | 0 / 0 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
All | sample_01.txt, sample_02.txt, testcase_1.txt, testcase_10.txt, testcase_11.txt, testcase_12.txt, testcase_13.txt, testcase_14.txt, testcase_15.txt, testcase_16.txt, testcase_17.txt, testcase_18.txt, testcase_19.txt, testcase_2.txt, testcase_20.txt, testcase_21.txt, testcase_22.txt, testcase_23.txt, testcase_24.txt, testcase_25.txt, testcase_26.txt, testcase_27.txt, testcase_28.txt, testcase_29.txt, testcase_3.txt, testcase_30.txt, testcase_4.txt, testcase_5.txt, testcase_6.txt, testcase_7.txt, testcase_8.txt, testcase_9.txt |
Sample | sample_01.txt, sample_02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 6 ms | 3616 KB |
sample_02.txt | AC | 2 ms | 3508 KB |
testcase_1.txt | AC | 2 ms | 3572 KB |
testcase_10.txt | AC | 2 ms | 3576 KB |
testcase_11.txt | WA | 2 ms | 3508 KB |
testcase_12.txt | WA | 2 ms | 3624 KB |
testcase_13.txt | WA | 3 ms | 3512 KB |
testcase_14.txt | WA | 2 ms | 3620 KB |
testcase_15.txt | WA | 3 ms | 3744 KB |
testcase_16.txt | WA | 2 ms | 3640 KB |
testcase_17.txt | WA | 5 ms | 3676 KB |
testcase_18.txt | WA | 3 ms | 3692 KB |
testcase_19.txt | WA | 2 ms | 3696 KB |
testcase_2.txt | AC | 3 ms | 3504 KB |
testcase_20.txt | AC | 4 ms | 3692 KB |
testcase_21.txt | AC | 3 ms | 3660 KB |
testcase_22.txt | WA | 2 ms | 3692 KB |
testcase_23.txt | WA | 2 ms | 3584 KB |
testcase_24.txt | WA | 4 ms | 3676 KB |
testcase_25.txt | WA | 3 ms | 3580 KB |
testcase_26.txt | WA | 3 ms | 3692 KB |
testcase_27.txt | WA | 4 ms | 3724 KB |
testcase_28.txt | WA | 2 ms | 3736 KB |
testcase_29.txt | WA | 2 ms | 3636 KB |
testcase_3.txt | WA | 2 ms | 3616 KB |
testcase_30.txt | WA | 2 ms | 3680 KB |
testcase_4.txt | WA | 3 ms | 3588 KB |
testcase_5.txt | AC | 3 ms | 3576 KB |
testcase_6.txt | WA | 2 ms | 3548 KB |
testcase_7.txt | WA | 1 ms | 3652 KB |
testcase_8.txt | WA | 2 ms | 3508 KB |
testcase_9.txt | WA | 4 ms | 3612 KB |