Submission #436299

#TimeUsernameProblemLanguageResultExecution timeMemory
436299AmineTrabelsiFun Tour (APIO20_fun)C++14
0 / 100
1 ms332 KiB
#include "fun.h" #include <bits/stdc++.h> using namespace std; const int M = 1e5 +5; vector<int> createFunTour(int N, int Q) { /* int H = hoursRequired(0, N - 1); int A = attractionsBehind(0, N - 1); */ int two = 1; int p = 0; vector<vector<int>> level; vector<int> l,r; while(p < N){ vector<int> curr; for(int i=0;i<two;i++){ if(p >= N)break; if(i < (two/2))l.push_back(p++); else r.push_back(p++); //curr.push_back(p++); } //level.push_back(curr); two *= 2; } reverse(l.begin(),l.end()); reverse(r.begin(),r.end()); /* for(auto i:l)cerr<<i<<" "; cerr<<'\n'; for(auto i:r)cerr<< i <<" "; cerr<<'\n'; */ vector<int> res; if(l.size() > r.size())swap(l,r); for(int i=0;i<(int)l.size();i++){ //cout << r[i] <<" "<<l[i] <<" "; res.push_back(r[i]); res.push_back(l[i]); } for(int i=(int)l.size();i<(int)r.size();i++){ res.push_back(r[i]); } return res; }
#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...