#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
const int M = 2000;
namespace {
tuple<int,int,int> generate(long long x){
long long curr = 0;
for(int len=4;len<=M;len++){
if(curr+3*(2*(len-1)-5)-1<x){
curr+=3*(2*(len-1)-5);
continue;
}
for(int turnedon=6;turnedon<=2*(len-1);turnedon++){
if(curr++==x)return {len,turnedon,0};
if(curr++==x)return {len,turnedon,1};
if(curr++==x)return {len,turnedon,3};
}
}
assert(false);
}
}
int Declare() {return M;}
pair<vector<int>, vector<int>> Anna(long long A) {
auto [len,ones,starting] = generate(A);
vector<int> a(len,0),b(len,0);
for(int i=0;i<starting;i++){
a[i]=b[i]=1;
ones-=2;
}
for(int i=starting+1;i<len;i++){
if(ones){a[i]=1;ones--;}
if(ones){b[i]=1;ones--;}
}
return {a,b};
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
const int M = 2000;
namespace {
long long generate(int tarlen,int taron,int starting){
long long curr = 0;
for(int len=4;len<=M;len++){
if(len!=tarlen){
curr+=3*(2*(len-1)-5);
continue;
}
for(int turnedon=6;turnedon<=2*(len-1);turnedon++){
if(turnedon!=taron){curr+=3;continue;}
if(starting==0)return curr;
curr++;
if(starting==1)return curr;
curr++;
if(starting==3)return curr;
curr++;
}
}
assert(false);
}
}
long long Bruno(vector<int> u) {
int len = u.size()/2;
int ones = 0;
for(int&i:u)ones+=i;
int starting = 0;
for(int&i:u){
if(i) starting++;
else break;
}
if(0<=starting and starting<=0)starting=0;
else if(1<=starting and starting<=2)starting=1;
else if(3<=starting and starting<=6)starting=3;
return generate(len,ones,starting);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
796 KB |
Output is correct |
2 |
Correct |
8 ms |
1108 KB |
Output is correct |
3 |
Correct |
10 ms |
1144 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
796 KB |
Output is correct |
2 |
Correct |
8 ms |
1108 KB |
Output is correct |
3 |
Correct |
10 ms |
1144 KB |
Output is correct |
4 |
Correct |
188 ms |
13268 KB |
Output is correct |
5 |
Correct |
186 ms |
13116 KB |
Output is correct |
6 |
Correct |
187 ms |
13300 KB |
Output is correct |
7 |
Correct |
185 ms |
12964 KB |
Output is correct |
8 |
Correct |
190 ms |
13400 KB |
Output is correct |
9 |
Correct |
292 ms |
19188 KB |
Output is correct |
10 |
Correct |
320 ms |
19184 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
796 KB |
Output is correct |
2 |
Correct |
8 ms |
1108 KB |
Output is correct |
3 |
Correct |
10 ms |
1144 KB |
Output is correct |
4 |
Correct |
188 ms |
13268 KB |
Output is correct |
5 |
Correct |
186 ms |
13116 KB |
Output is correct |
6 |
Correct |
187 ms |
13300 KB |
Output is correct |
7 |
Correct |
185 ms |
12964 KB |
Output is correct |
8 |
Correct |
190 ms |
13400 KB |
Output is correct |
9 |
Correct |
292 ms |
19188 KB |
Output is correct |
10 |
Correct |
320 ms |
19184 KB |
Output is correct |
11 |
Correct |
301 ms |
20928 KB |
Output is correct |
12 |
Correct |
302 ms |
20476 KB |
Output is correct |
13 |
Correct |
291 ms |
20268 KB |
Output is correct |
14 |
Correct |
297 ms |
20236 KB |
Output is correct |
15 |
Correct |
297 ms |
20144 KB |
Output is correct |
16 |
Correct |
478 ms |
29948 KB |
Output is correct |
17 |
Correct |
473 ms |
29728 KB |
Output is correct |
18 |
Correct |
217 ms |
15056 KB |
Output is correct |
19 |
Correct |
218 ms |
15508 KB |
Output is correct |
20 |
Correct |
210 ms |
14920 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
796 KB |
Output is correct |
2 |
Correct |
8 ms |
1108 KB |
Output is correct |
3 |
Correct |
10 ms |
1144 KB |
Output is correct |
4 |
Correct |
188 ms |
13268 KB |
Output is correct |
5 |
Correct |
186 ms |
13116 KB |
Output is correct |
6 |
Correct |
187 ms |
13300 KB |
Output is correct |
7 |
Correct |
185 ms |
12964 KB |
Output is correct |
8 |
Correct |
190 ms |
13400 KB |
Output is correct |
9 |
Correct |
292 ms |
19188 KB |
Output is correct |
10 |
Correct |
320 ms |
19184 KB |
Output is correct |
11 |
Correct |
301 ms |
20928 KB |
Output is correct |
12 |
Correct |
302 ms |
20476 KB |
Output is correct |
13 |
Correct |
291 ms |
20268 KB |
Output is correct |
14 |
Correct |
297 ms |
20236 KB |
Output is correct |
15 |
Correct |
297 ms |
20144 KB |
Output is correct |
16 |
Correct |
478 ms |
29948 KB |
Output is correct |
17 |
Correct |
473 ms |
29728 KB |
Output is correct |
18 |
Correct |
217 ms |
15056 KB |
Output is correct |
19 |
Correct |
218 ms |
15508 KB |
Output is correct |
20 |
Correct |
210 ms |
14920 KB |
Output is correct |
21 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
796 KB |
Output is correct |
2 |
Correct |
8 ms |
1108 KB |
Output is correct |
3 |
Correct |
10 ms |
1144 KB |
Output is correct |
4 |
Correct |
188 ms |
13268 KB |
Output is correct |
5 |
Correct |
186 ms |
13116 KB |
Output is correct |
6 |
Correct |
187 ms |
13300 KB |
Output is correct |
7 |
Correct |
185 ms |
12964 KB |
Output is correct |
8 |
Correct |
190 ms |
13400 KB |
Output is correct |
9 |
Correct |
292 ms |
19188 KB |
Output is correct |
10 |
Correct |
320 ms |
19184 KB |
Output is correct |
11 |
Correct |
301 ms |
20928 KB |
Output is correct |
12 |
Correct |
302 ms |
20476 KB |
Output is correct |
13 |
Correct |
291 ms |
20268 KB |
Output is correct |
14 |
Correct |
297 ms |
20236 KB |
Output is correct |
15 |
Correct |
297 ms |
20144 KB |
Output is correct |
16 |
Correct |
478 ms |
29948 KB |
Output is correct |
17 |
Correct |
473 ms |
29728 KB |
Output is correct |
18 |
Correct |
217 ms |
15056 KB |
Output is correct |
19 |
Correct |
218 ms |
15508 KB |
Output is correct |
20 |
Correct |
210 ms |
14920 KB |
Output is correct |
21 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
856 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |