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 "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;
vector<bool> vis(N+1,0);
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]);
vis[r[i]] = vis[l[i]] = 1;
}
if((int)l.size() < (int)r.size()){
res.push_back(r[(int)l.size()]);
vis[r[(int)l.size()]] = 1;
}
res.push_back(0);
vector<int> hard = {8,4,7,1,3};
for(int i=(int)l.size()+1;i<(int)r.size()-5;i++){
res.push_back(r[i]);
}
for(auto i:hard)if(i < N && !vis[i])res.push_back(i);
//for(auto i:res)cout<<i<<" ";
return res;
}
# | 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... |