#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
namespace AA{
const int L=140;
ll dp[L+5];
void init(){
dp[1]=dp[2]=1;dp[3]=2;
for(int i=4;i<=L;i++) dp[i]=dp[i-2]+dp[i-3]+1;
}
pair<vector<int>,vector<int>> solve(long long A){
init();
int l=1,x=A&1;A>>=1;
while(A>=dp[l]) A-=dp[l++];
vector<int> a(l,0),b(l,0);
for(int i=0;i<l;i++) a[i]=(x+i)&1;
b[0]=x;
for(int i=1;i<l;i++){
if(A==0) b[i]=b[i-1]^1;
else if(A<=dp[l-i-1]) A--,b[i]=b[i+1]=b[i-1],i++;
else A-=(dp[l-i-1]+1),b[i]=b[i+1]=b[i+2]=b[i-1]^1,i+=2;
}
return {a,b};
}
}
int Declare(){
return 140;
}
std::pair<std::vector<int>, std::vector<int> > Anna(long long A) {
return AA::solve(A);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
namespace BB{
const int L=140;
ll dp[L+5];
void init(){
dp[1]=dp[2]=1;dp[3]=2;
for(int i=4;i<=L;i++) dp[i]=dp[i-2]+dp[i-3]+1;
}
ll solve(vector<int> x){
init();
ll A=x[0];
int l=(int)x.size()/2;
for(int i=2*l-1;i>=0;i--) x[i]^=x[0];
for(int i=1;i<l;i++) A+=2*dp[i];
int c=0,d=0;
for(int i=1,j=1;j<2*l;j++){
d+=(x[j]?-1:1);
if(d>=2){
if(c==0) A+=2,i+=2;
else A+=(dp[l-i-1]+1)*2,i+=3;
c=d=0;
}
else if(d<=-2){
if(c==1) A+=2,i+=2;
else A+=(dp[l-i-1]+1)*2,i+=3;
c=1;d=0;
}
}
return A;
}
}
long long Bruno(std::vector<int> u) {
return BB::solve(u);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
784 KB |
Output is correct |
2 |
Correct |
12 ms |
1100 KB |
Output is correct |
3 |
Correct |
12 ms |
1216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
784 KB |
Output is correct |
2 |
Correct |
12 ms |
1100 KB |
Output is correct |
3 |
Correct |
12 ms |
1216 KB |
Output is correct |
4 |
Correct |
20 ms |
1468 KB |
Output is correct |
5 |
Correct |
25 ms |
1596 KB |
Output is correct |
6 |
Correct |
22 ms |
1476 KB |
Output is correct |
7 |
Correct |
20 ms |
1476 KB |
Output is correct |
8 |
Correct |
20 ms |
1580 KB |
Output is correct |
9 |
Correct |
20 ms |
1492 KB |
Output is correct |
10 |
Correct |
20 ms |
1560 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
784 KB |
Output is correct |
2 |
Correct |
12 ms |
1100 KB |
Output is correct |
3 |
Correct |
12 ms |
1216 KB |
Output is correct |
4 |
Correct |
20 ms |
1468 KB |
Output is correct |
5 |
Correct |
25 ms |
1596 KB |
Output is correct |
6 |
Correct |
22 ms |
1476 KB |
Output is correct |
7 |
Correct |
20 ms |
1476 KB |
Output is correct |
8 |
Correct |
20 ms |
1580 KB |
Output is correct |
9 |
Correct |
20 ms |
1492 KB |
Output is correct |
10 |
Correct |
20 ms |
1560 KB |
Output is correct |
11 |
Correct |
28 ms |
1560 KB |
Output is correct |
12 |
Correct |
22 ms |
1600 KB |
Output is correct |
13 |
Correct |
23 ms |
1488 KB |
Output is correct |
14 |
Correct |
22 ms |
1492 KB |
Output is correct |
15 |
Correct |
20 ms |
1404 KB |
Output is correct |
16 |
Correct |
22 ms |
1512 KB |
Output is correct |
17 |
Correct |
20 ms |
1580 KB |
Output is correct |
18 |
Correct |
22 ms |
1380 KB |
Output is correct |
19 |
Correct |
22 ms |
1468 KB |
Output is correct |
20 |
Correct |
20 ms |
1564 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
784 KB |
Output is correct |
2 |
Correct |
12 ms |
1100 KB |
Output is correct |
3 |
Correct |
12 ms |
1216 KB |
Output is correct |
4 |
Correct |
20 ms |
1468 KB |
Output is correct |
5 |
Correct |
25 ms |
1596 KB |
Output is correct |
6 |
Correct |
22 ms |
1476 KB |
Output is correct |
7 |
Correct |
20 ms |
1476 KB |
Output is correct |
8 |
Correct |
20 ms |
1580 KB |
Output is correct |
9 |
Correct |
20 ms |
1492 KB |
Output is correct |
10 |
Correct |
20 ms |
1560 KB |
Output is correct |
11 |
Correct |
28 ms |
1560 KB |
Output is correct |
12 |
Correct |
22 ms |
1600 KB |
Output is correct |
13 |
Correct |
23 ms |
1488 KB |
Output is correct |
14 |
Correct |
22 ms |
1492 KB |
Output is correct |
15 |
Correct |
20 ms |
1404 KB |
Output is correct |
16 |
Correct |
22 ms |
1512 KB |
Output is correct |
17 |
Correct |
20 ms |
1580 KB |
Output is correct |
18 |
Correct |
22 ms |
1380 KB |
Output is correct |
19 |
Correct |
22 ms |
1468 KB |
Output is correct |
20 |
Correct |
20 ms |
1564 KB |
Output is correct |
21 |
Correct |
24 ms |
1760 KB |
Output is correct |
22 |
Correct |
27 ms |
2020 KB |
Output is correct |
23 |
Correct |
25 ms |
1780 KB |
Output is correct |
24 |
Correct |
26 ms |
1764 KB |
Output is correct |
25 |
Correct |
27 ms |
1704 KB |
Output is correct |
26 |
Correct |
25 ms |
1732 KB |
Output is correct |
27 |
Correct |
24 ms |
2260 KB |
Output is correct |
28 |
Correct |
23 ms |
1488 KB |
Output is correct |
29 |
Correct |
20 ms |
1660 KB |
Output is correct |
30 |
Correct |
23 ms |
1492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
784 KB |
Output is correct |
2 |
Correct |
12 ms |
1100 KB |
Output is correct |
3 |
Correct |
12 ms |
1216 KB |
Output is correct |
4 |
Correct |
20 ms |
1468 KB |
Output is correct |
5 |
Correct |
25 ms |
1596 KB |
Output is correct |
6 |
Correct |
22 ms |
1476 KB |
Output is correct |
7 |
Correct |
20 ms |
1476 KB |
Output is correct |
8 |
Correct |
20 ms |
1580 KB |
Output is correct |
9 |
Correct |
20 ms |
1492 KB |
Output is correct |
10 |
Correct |
20 ms |
1560 KB |
Output is correct |
11 |
Correct |
28 ms |
1560 KB |
Output is correct |
12 |
Correct |
22 ms |
1600 KB |
Output is correct |
13 |
Correct |
23 ms |
1488 KB |
Output is correct |
14 |
Correct |
22 ms |
1492 KB |
Output is correct |
15 |
Correct |
20 ms |
1404 KB |
Output is correct |
16 |
Correct |
22 ms |
1512 KB |
Output is correct |
17 |
Correct |
20 ms |
1580 KB |
Output is correct |
18 |
Correct |
22 ms |
1380 KB |
Output is correct |
19 |
Correct |
22 ms |
1468 KB |
Output is correct |
20 |
Correct |
20 ms |
1564 KB |
Output is correct |
21 |
Correct |
24 ms |
1760 KB |
Output is correct |
22 |
Correct |
27 ms |
2020 KB |
Output is correct |
23 |
Correct |
25 ms |
1780 KB |
Output is correct |
24 |
Correct |
26 ms |
1764 KB |
Output is correct |
25 |
Correct |
27 ms |
1704 KB |
Output is correct |
26 |
Correct |
25 ms |
1732 KB |
Output is correct |
27 |
Correct |
24 ms |
2260 KB |
Output is correct |
28 |
Correct |
23 ms |
1488 KB |
Output is correct |
29 |
Correct |
20 ms |
1660 KB |
Output is correct |
30 |
Correct |
23 ms |
1492 KB |
Output is correct |
31 |
Correct |
32 ms |
2136 KB |
Output is correct |
32 |
Correct |
32 ms |
2120 KB |
Output is correct |
33 |
Correct |
34 ms |
1936 KB |
Output is correct |
34 |
Correct |
32 ms |
2112 KB |
Output is correct |
35 |
Correct |
32 ms |
2212 KB |
Output is correct |
36 |
Correct |
33 ms |
2152 KB |
Output is correct |
37 |
Correct |
28 ms |
2228 KB |
Output is correct |
38 |
Correct |
28 ms |
1752 KB |
Output is correct |
39 |
Correct |
28 ms |
1868 KB |
Output is correct |
40 |
Correct |
28 ms |
1832 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
2800 KB |
Output is correct |
2 |
Correct |
50 ms |
3272 KB |
Output is correct |
3 |
Correct |
50 ms |
3172 KB |
Output is correct |
4 |
Correct |
50 ms |
3152 KB |
Output is correct |
5 |
Correct |
50 ms |
2924 KB |
Output is correct |
6 |
Correct |
52 ms |
3048 KB |
Output is correct |
7 |
Correct |
53 ms |
2804 KB |
Output is correct |
8 |
Correct |
50 ms |
3160 KB |
Output is correct |
9 |
Correct |
50 ms |
3092 KB |
Output is correct |
10 |
Correct |
51 ms |
3056 KB |
Output is correct |
11 |
Correct |
52 ms |
2916 KB |
Output is correct |
12 |
Correct |
50 ms |
2868 KB |
Output is correct |
13 |
Correct |
49 ms |
3140 KB |
Output is correct |
14 |
Correct |
46 ms |
3416 KB |
Output is correct |
15 |
Correct |
46 ms |
2852 KB |
Output is correct |
16 |
Correct |
45 ms |
3032 KB |
Output is correct |
17 |
Correct |
53 ms |
3044 KB |
Output is correct |
18 |
Correct |
47 ms |
2764 KB |
Output is correct |
19 |
Correct |
46 ms |
2796 KB |
Output is correct |
20 |
Correct |
47 ms |
2964 KB |
Output is correct |