# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
788517 | Andrey | Mechanical Doll (IOI18_doll) | C++14 | 1062 ms | 16588 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;
vector<int> haha[200001];
vector<int> idk(500001);
int br = 1;
vector<int> x(0);
vector<int> y(0);
void dude(int a) {
x.push_back(0);
y.push_back(0);
int ind = br-1;
br++;
int z = 1;
while(z*2 < a) {
z*=2;
}
if(a-z == 1) {
x[ind] = INT_MAX;
}
else {
x[ind] = -br;
dude(a-z);
}
if(z == 1) {
y[ind] = INT_MAX;
}
else {
y[ind] = -br;
dude(z);
}
}
void create_circuit(int m, vector<int> bruh) {
vector<int> c(m+1);
c[0] = bruh[0];
int n = bruh.size();
bruh.push_back(0);
int a,z = 0,b,p,d,e;
for(int i = 0; i < n; i++) {
haha[bruh[i]].push_back(bruh[i+1]);
}
for(int i = 0; i < 200001; i++) {
if(haha[i].empty()) {
continue;
}
if(haha[i].size() == 1) {
c[i] = haha[i][0];
}
else {
c[i] = -br;
dude(haha[i].size());
p = 0;
for(int j = 0; j < haha[i].size(); j++) {
d = -c[i];
if((++idk[d-1])%2) {
e = x[d-1];
}
else {
e = y[d-1];
}
while(e != INT_MAX) {
d = -e;
if((++idk[d-1])%2) {
e = x[d-1];
}
else {
e = y[d-1];
}
}
if(idk[d-1]%2 == 1) {
x[d-1] = haha[i][j];
}
else {
y[d-1] = haha[i][j];
}
}
}
}
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... |