| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 421811 | A_D | Mechanical Doll (IOI18_doll) | C++14 | 60 ms | 12036 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 "doll.h"
#include <bits/stdc++.h>
using namespace std;
const int NN=2e5+100;
vector<int> vec[NN];
vector<int> x,y,c;
int cnt,mx=0;
void fix(int p,int l,int sum,int i)
{
mx=max(mx,p+cnt);
if(l+sum>=vec[i].size()){
x[p+cnt-1]=(-p-cnt);
y[p+cnt-1]=(vec[i][l]);
return;
}
x[p+cnt-1]=(-(p*2)-cnt);
y[p+cnt-1]=(-(p*2+1)-cnt);
fix(p*2,l,sum*2,i);
fix(p*2+1,l+sum,sum*2,i);
}
void create_circuit(int m,vector<int>a){
x.resize(300000);
y.resize(300000);
int n = a.size();
for(int i=0;i<n-1;i++){
vec[a[i]].push_back(a[i+1]);
}
vec[a[n-1]].push_back(0);
c.push_back(a[0]);
for(int i=1;i<=m;i++){
if(vec[i].size()==0){
c.push_back(0);
continue;
}
cnt=mx;
c.push_back(-cnt-1);
fix(1,0,1,i);
}
answer(c,x,y);
}
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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
