| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1060228 | TlenekWodoru | Mechanical Doll (IOI18_doll) | C++14 | 53 ms | 13808 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<bits/stdc++.h>
#include "doll.h"
using namespace std;
vector<pair<int,int>>U;
int Graf[2100009][2];
int h=1;
void F(int n)
{
if(n==2)
{
U.push_back({1,0});
U.push_back({1,1});
return;
}
F((n+1)/2);
vector<pair<int,int>>A,B;
if(n%2==0)
{
for(auto[v,u] : U)
{
h++;
Graf[v][u]=h;
A.push_back({h,0});
B.push_back({h,1});
}
}
else
{
bool CzyPierwszy=1;
for(auto[v,u] : U)
{
h++;
Graf[v][u]=h;
if(CzyPierwszy)
{
CzyPierwszy=0;
Graf[h][1]=1;
A.push_back({h,0});
B.push_back({-1,-1});
}
else
{
A.push_back({h,0});
B.push_back({h,1});
}
}
}
U.clear();
for(auto xd : A)
{
U.push_back(xd);
}
for(auto xd : B)
{
if(xd.first==-1){continue;}
U.push_back(xd);
}
}
void create_circuit(int M, vector<int>A)
{
A.push_back(0);
F(A.size());
vector<int>C(M+1,-1);
vector<int>X(h),Y(h);
for(int i=1;i<=h;i++)
{
X[i-1]=-Graf[i][0];
Y[i-1]=-Graf[i][1];
}
for(int i=0;i<(int)U.size();i++)
{
if(U[i].second==0)
{
X[U[i].first-1]=A[i];
}
else
{
Y[U[i].first-1]=A[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... | ||||
