# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
657879 | activedeltorre | Fun Tour (APIO20_fun) | C++14 | 2 ms | 2644 KiB |
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 <vector>
using namespace std;
int cnt=0;
int poz[100005];
vector<int>adj[100005];
void dfs(int curr)
{
int i,k;
for(i=0;i<adj[curr].size();i++)
{
k=adj[curr][i];
dfs(k);
}
poz[cnt]=curr;
cnt++;
}
vector<int> createFunTour(int n, int q)
{
int i,st,dr;
vector<int>vec;
for(i=1; i<n; i++)
{
adj[(i-1)/2].push_back(i);
}
dfs(0);
st=0;
dr=n-1;
while(st<dr)
{
vec.push_back(poz[st]);
vec.push_back(poz[dr]);
dr--;
st++;
}
if(st==dr)
{
vec.push_back(poz[st]);
}
return vec;
}
Compilation message (stderr)
# | 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... |