This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <queue>
#include <vector>
#include <set>
using namespace std;
std::vector<int> createFunTour(int N, int Q) {
vector<int> A = {};
while(N > 1){
int d = 0;
while((1<<(d+1)) <= N) d++;
if(N+1-(1<<d) > (1<<(d-1))){
int s = (1<<d)+(1<<(d+1))-3;
int c = 0;
for(int i=(1<<d)-1;i<(1<<d)-1+(1<<(d-1));i++)if(s-i < N){
A.push_back(i);
A.push_back(s-i);
c += 2;
}
N -= c;
continue;
}
if(N+1-(1<<d) > ((1<<(d-1))-1)/2+1){
int s = (1<<d)+(1<<d)+(1<<(d-1))-3;
int c = 0;
for(int i=0;i<(1<<(d-1))/2;i++)if(s-i < N){
A.push_back(i);
A.push_back(s-1);
c+=2;
}
N -= c;
continue;
}
int c = 0;
for(int i=(1<<d)-1;i<N;i++){
c += 2;
A.push_back(i);
A.push_back(i-1);
}
N -= c;
}
if(N == 1) A.push_back(0);
return A;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |