Submission #735438

#TimeUsernameProblemLanguageResultExecution timeMemory
735438keisuke6Fun Tour (APIO20_fun)C++14
0 / 100
2062 ms296 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...