#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++){
for(int turnedon=0;turnedon<=2*len;turnedon++){
if(curr++==x)return {len,turnedon};
}
}
}
}
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++){
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);
}
Compilation message
Anna.cpp: In function 'std::pair<int, int> {anonymous}::generate(long long int)':
Anna.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
16 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
2 |
Correct |
13 ms |
1232 KB |
Output is correct |
3 |
Correct |
16 ms |
1452 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
2 |
Correct |
13 ms |
1232 KB |
Output is correct |
3 |
Correct |
16 ms |
1452 KB |
Output is correct |
4 |
Execution timed out |
2031 ms |
22144 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
2 |
Correct |
13 ms |
1232 KB |
Output is correct |
3 |
Correct |
16 ms |
1452 KB |
Output is correct |
4 |
Execution timed out |
2031 ms |
22144 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
2 |
Correct |
13 ms |
1232 KB |
Output is correct |
3 |
Correct |
16 ms |
1452 KB |
Output is correct |
4 |
Execution timed out |
2031 ms |
22144 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
2 |
Correct |
13 ms |
1232 KB |
Output is correct |
3 |
Correct |
16 ms |
1452 KB |
Output is correct |
4 |
Execution timed out |
2031 ms |
22144 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2061 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |