#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
const int M = 2000;
namespace {
pair<int,int> generate(long long x){
long long curr = 0;
for(int len=1;len<=M;len++){
if(curr+2*len<x){
curr+=2*len + 1;
continue;
}
for(int turnedon=0;turnedon<=2*len;turnedon++){
if(curr++==x)return {len,turnedon};
}
}
assert(false);
}
}
int Declare() {return M;}
pair<vector<int>, vector<int>> Anna(long long A) {
auto [len,ones] = generate(A);
vector<int> a(len,0),b(len,0);
for(int&i:a)if(ones){i=1;ones--;}
for(int&i:b)if(ones){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){
long long curr = 0;
for(int len=1;len<=M;len++){
if(len!=tarlen){
curr+=2*len + 1;
continue;
}
for(int turnedon=0;turnedon<=2*len;turnedon++){
if(len==tarlen and turnedon==taron)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;
return generate(len,ones);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
796 KB |
Output is correct |
2 |
Correct |
10 ms |
1128 KB |
Output is correct |
3 |
Correct |
13 ms |
1464 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
796 KB |
Output is correct |
2 |
Correct |
10 ms |
1128 KB |
Output is correct |
3 |
Correct |
13 ms |
1464 KB |
Output is correct |
4 |
Correct |
354 ms |
22012 KB |
Output is correct |
5 |
Correct |
327 ms |
21868 KB |
Output is correct |
6 |
Correct |
334 ms |
22288 KB |
Output is correct |
7 |
Correct |
325 ms |
21712 KB |
Output is correct |
8 |
Correct |
366 ms |
22228 KB |
Output is correct |
9 |
Correct |
478 ms |
32812 KB |
Output is correct |
10 |
Correct |
468 ms |
32736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
796 KB |
Output is correct |
2 |
Correct |
10 ms |
1128 KB |
Output is correct |
3 |
Correct |
13 ms |
1464 KB |
Output is correct |
4 |
Correct |
354 ms |
22012 KB |
Output is correct |
5 |
Correct |
327 ms |
21868 KB |
Output is correct |
6 |
Correct |
334 ms |
22288 KB |
Output is correct |
7 |
Correct |
325 ms |
21712 KB |
Output is correct |
8 |
Correct |
366 ms |
22228 KB |
Output is correct |
9 |
Correct |
478 ms |
32812 KB |
Output is correct |
10 |
Correct |
468 ms |
32736 KB |
Output is correct |
11 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
796 KB |
Output is correct |
2 |
Correct |
10 ms |
1128 KB |
Output is correct |
3 |
Correct |
13 ms |
1464 KB |
Output is correct |
4 |
Correct |
354 ms |
22012 KB |
Output is correct |
5 |
Correct |
327 ms |
21868 KB |
Output is correct |
6 |
Correct |
334 ms |
22288 KB |
Output is correct |
7 |
Correct |
325 ms |
21712 KB |
Output is correct |
8 |
Correct |
366 ms |
22228 KB |
Output is correct |
9 |
Correct |
478 ms |
32812 KB |
Output is correct |
10 |
Correct |
468 ms |
32736 KB |
Output is correct |
11 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
796 KB |
Output is correct |
2 |
Correct |
10 ms |
1128 KB |
Output is correct |
3 |
Correct |
13 ms |
1464 KB |
Output is correct |
4 |
Correct |
354 ms |
22012 KB |
Output is correct |
5 |
Correct |
327 ms |
21868 KB |
Output is correct |
6 |
Correct |
334 ms |
22288 KB |
Output is correct |
7 |
Correct |
325 ms |
21712 KB |
Output is correct |
8 |
Correct |
366 ms |
22228 KB |
Output is correct |
9 |
Correct |
478 ms |
32812 KB |
Output is correct |
10 |
Correct |
468 ms |
32736 KB |
Output is correct |
11 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |