Submission #436321

#TimeUsernameProblemLanguageResultExecution timeMemory
436321AmineTrabelsiFun Tour (APIO20_fun)C++14
0 / 100
2 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 = 2; int p = 1; 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]); } if((int)l.size() < (int)r.size())res.push_back(r[(int)l.size()]); res.push_back(0); for(int i=(int)l.size()+1;i<(int)r.size();i++){ res.push_back(r[i]); } //for(auto i:res)cout<<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...