#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
namespace {
int variable_example = 0;
int Zero[10000002], One[10000002];
bool Front[10000002], Back[10000002];
int rescnt;
}
int Declare() {
for(int i=8; i<=2000; i++){
for(int j=4; j<=i+i-4; j++){
for(int f=0; f<2; f++){
for(int b=0; b<2; b++){
++rescnt;
Zero[rescnt] = j, One[rescnt] = i+i-j;
Front[rescnt] = f, Back[rescnt] = b;
if(rescnt == 10000000) goto escape;
}
}
}
}
exit(1);
escape:
return 2000;
}
pair<vector<int>, vector<int> > Anna(ll X){
vector<int> A, B;
int len = (Zero[X] + One[X]) / 2;
A.resize(len), B.resize(len);
int need0 = Zero[X] - (!Front[X] + !Back[X])*2;
int need1 = One[X] - (!!Front[X] + !!Back[X])*2;
if(need1 <= len-2) for(int i=1; i<=need1; i++) A[i] = 1;
else{
for(int i=1; i<=len-2; i++) A[i] = 1;
for(int i=1; i<=(need1-(len-2)); i++) B[i]=1;
}
A[0]=B[0]=Front[X], A.back()=B.back()=Back[X];
return make_pair(A, B);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
namespace {
bool initialized = 0;
int result[4002][4002][2][2], rescnt;
int variable_example = 0;
}
void init(){
for(int i=8; i<=2000; i++){
for(int j=4; j<=i+i-4; j++){
for(int f=0; f<2; f++){
for(int b=0; b<2; b++){
++rescnt;
result[j][i+i-j][f][b] = rescnt;
if(rescnt == 10000000) goto escape;
}
}
}
}
exit(1);
escape:
initialized = 1;
}
ll Bruno(vector<int> u){
if(!initialized) init();
return result[count(u.begin(), u.end(), 0)][count(u.begin(), u.end(), 1)][u[0]][u.back()];
}
Compilation message
Anna.cpp: In function 'std::pair<std::vector<int>, std::vector<int> > Anna(ll)':
Anna.cpp:38:9: warning: unused variable 'need0' [-Wunused-variable]
38 | int need0 = Zero[X] - (!Front[X] + !Back[X])*2;
| ^~~~~
Anna.cpp: At global scope:
Anna.cpp:9:9: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
9 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
Bruno.cpp:11:9: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
11 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
151 ms |
189400 KB |
Output is correct |
2 |
Correct |
140 ms |
189636 KB |
Output is correct |
3 |
Correct |
154 ms |
189868 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
151 ms |
189400 KB |
Output is correct |
2 |
Correct |
140 ms |
189636 KB |
Output is correct |
3 |
Correct |
154 ms |
189868 KB |
Output is correct |
4 |
Correct |
372 ms |
200416 KB |
Output is correct |
5 |
Correct |
399 ms |
200304 KB |
Output is correct |
6 |
Correct |
398 ms |
200588 KB |
Output is correct |
7 |
Correct |
413 ms |
200156 KB |
Output is correct |
8 |
Correct |
401 ms |
200452 KB |
Output is correct |
9 |
Correct |
536 ms |
205500 KB |
Output is correct |
10 |
Correct |
518 ms |
205464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
151 ms |
189400 KB |
Output is correct |
2 |
Correct |
140 ms |
189636 KB |
Output is correct |
3 |
Correct |
154 ms |
189868 KB |
Output is correct |
4 |
Correct |
372 ms |
200416 KB |
Output is correct |
5 |
Correct |
399 ms |
200304 KB |
Output is correct |
6 |
Correct |
398 ms |
200588 KB |
Output is correct |
7 |
Correct |
413 ms |
200156 KB |
Output is correct |
8 |
Correct |
401 ms |
200452 KB |
Output is correct |
9 |
Correct |
536 ms |
205500 KB |
Output is correct |
10 |
Correct |
518 ms |
205464 KB |
Output is correct |
11 |
Correct |
530 ms |
206988 KB |
Output is correct |
12 |
Correct |
516 ms |
206692 KB |
Output is correct |
13 |
Correct |
518 ms |
206460 KB |
Output is correct |
14 |
Correct |
554 ms |
206736 KB |
Output is correct |
15 |
Correct |
514 ms |
206420 KB |
Output is correct |
16 |
Correct |
702 ms |
214912 KB |
Output is correct |
17 |
Correct |
733 ms |
215012 KB |
Output is correct |
18 |
Correct |
428 ms |
201896 KB |
Output is correct |
19 |
Correct |
432 ms |
202212 KB |
Output is correct |
20 |
Correct |
410 ms |
201684 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
151 ms |
189400 KB |
Output is correct |
2 |
Correct |
140 ms |
189636 KB |
Output is correct |
3 |
Correct |
154 ms |
189868 KB |
Output is correct |
4 |
Correct |
372 ms |
200416 KB |
Output is correct |
5 |
Correct |
399 ms |
200304 KB |
Output is correct |
6 |
Correct |
398 ms |
200588 KB |
Output is correct |
7 |
Correct |
413 ms |
200156 KB |
Output is correct |
8 |
Correct |
401 ms |
200452 KB |
Output is correct |
9 |
Correct |
536 ms |
205500 KB |
Output is correct |
10 |
Correct |
518 ms |
205464 KB |
Output is correct |
11 |
Correct |
530 ms |
206988 KB |
Output is correct |
12 |
Correct |
516 ms |
206692 KB |
Output is correct |
13 |
Correct |
518 ms |
206460 KB |
Output is correct |
14 |
Correct |
554 ms |
206736 KB |
Output is correct |
15 |
Correct |
514 ms |
206420 KB |
Output is correct |
16 |
Correct |
702 ms |
214912 KB |
Output is correct |
17 |
Correct |
733 ms |
215012 KB |
Output is correct |
18 |
Correct |
428 ms |
201896 KB |
Output is correct |
19 |
Correct |
432 ms |
202212 KB |
Output is correct |
20 |
Correct |
410 ms |
201684 KB |
Output is correct |
21 |
Runtime error |
140 ms |
198756 KB |
Execution killed with signal 11 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
151 ms |
189400 KB |
Output is correct |
2 |
Correct |
140 ms |
189636 KB |
Output is correct |
3 |
Correct |
154 ms |
189868 KB |
Output is correct |
4 |
Correct |
372 ms |
200416 KB |
Output is correct |
5 |
Correct |
399 ms |
200304 KB |
Output is correct |
6 |
Correct |
398 ms |
200588 KB |
Output is correct |
7 |
Correct |
413 ms |
200156 KB |
Output is correct |
8 |
Correct |
401 ms |
200452 KB |
Output is correct |
9 |
Correct |
536 ms |
205500 KB |
Output is correct |
10 |
Correct |
518 ms |
205464 KB |
Output is correct |
11 |
Correct |
530 ms |
206988 KB |
Output is correct |
12 |
Correct |
516 ms |
206692 KB |
Output is correct |
13 |
Correct |
518 ms |
206460 KB |
Output is correct |
14 |
Correct |
554 ms |
206736 KB |
Output is correct |
15 |
Correct |
514 ms |
206420 KB |
Output is correct |
16 |
Correct |
702 ms |
214912 KB |
Output is correct |
17 |
Correct |
733 ms |
215012 KB |
Output is correct |
18 |
Correct |
428 ms |
201896 KB |
Output is correct |
19 |
Correct |
432 ms |
202212 KB |
Output is correct |
20 |
Correct |
410 ms |
201684 KB |
Output is correct |
21 |
Runtime error |
140 ms |
198756 KB |
Execution killed with signal 11 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
159 ms |
198808 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |