Submission #18574554
Source Code Expand
Copy
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
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(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------
int N;
string T;
string S;
ll R=10000000000LL;
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>N>>T;
FOR(i,200000) S+="110";
ll ret=0;
if(N==1) {
if(T=="0") ret=R;
else ret=2*R;
}
else if(N==2) {
if(T=="00") ret=0;
if(T=="11") ret=R;
if(T=="10") ret=R;
if(T=="01") ret=R-1;
}
else {
FOR(i,3) {
if(S.substr(i,N)==T) {
ll la=i+T.size();
ret=(R*3-la)/3+1;
}
}
}
cout<<ret<<endl;
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
cout.tie(0); solve(); return 0;
}
Submission Info
Submission Time |
|
Task |
B - Many 110 |
User |
kmjp |
Language |
C++ (GCC 9.2.1) |
Score |
400 |
Code Size |
1283 Byte |
Status |
AC |
Exec Time |
11 ms |
Memory |
4472 KB |
Compile Error
./Main.cpp: In function ‘void solve()’:
./Main.cpp:21:8: warning: unused variable ‘j’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp:21:10: warning: unused variable ‘k’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp:21:12: warning: unused variable ‘l’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp:21:14: warning: unused variable ‘r’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp:21:16: warning: unused variable ‘x’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp:21:18: warning: unused variable ‘y’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp: In function ‘int main(int, char**)’:
./Main.cpp:6:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
6 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^
./Main.cpp:53:38: note: in expansion of macro ‘FOR’
53 | FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
| ^~~
Judge Result
Set Name |
All |
Sample |
Score / Max Score |
400 / 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 |
9 ms |
4036 KB |
sample_02.txt |
AC |
6 ms |
4248 KB |
testcase_1.txt |
AC |
11 ms |
4264 KB |
testcase_10.txt |
AC |
6 ms |
4148 KB |
testcase_11.txt |
AC |
9 ms |
4156 KB |
testcase_12.txt |
AC |
9 ms |
4216 KB |
testcase_13.txt |
AC |
6 ms |
4104 KB |
testcase_14.txt |
AC |
8 ms |
4160 KB |
testcase_15.txt |
AC |
7 ms |
4460 KB |
testcase_16.txt |
AC |
8 ms |
4428 KB |
testcase_17.txt |
AC |
9 ms |
4344 KB |
testcase_18.txt |
AC |
7 ms |
4364 KB |
testcase_19.txt |
AC |
6 ms |
4304 KB |
testcase_2.txt |
AC |
8 ms |
4248 KB |
testcase_20.txt |
AC |
7 ms |
4308 KB |
testcase_21.txt |
AC |
9 ms |
4328 KB |
testcase_22.txt |
AC |
7 ms |
4472 KB |
testcase_23.txt |
AC |
9 ms |
4168 KB |
testcase_24.txt |
AC |
7 ms |
4308 KB |
testcase_25.txt |
AC |
7 ms |
4388 KB |
testcase_26.txt |
AC |
7 ms |
4260 KB |
testcase_27.txt |
AC |
7 ms |
4380 KB |
testcase_28.txt |
AC |
10 ms |
4380 KB |
testcase_29.txt |
AC |
6 ms |
4100 KB |
testcase_3.txt |
AC |
6 ms |
4092 KB |
testcase_30.txt |
AC |
5 ms |
4320 KB |
testcase_4.txt |
AC |
6 ms |
4032 KB |
testcase_5.txt |
AC |
5 ms |
4260 KB |
testcase_6.txt |
AC |
3 ms |
4204 KB |
testcase_7.txt |
AC |
11 ms |
4036 KB |
testcase_8.txt |
AC |
5 ms |
4148 KB |
testcase_9.txt |
AC |
9 ms |
4036 KB |