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)
doll.cpp: In function 'void F(int)':
doll.cpp:19:17: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
19 | for(auto[v,u] : U)
| ^
doll.cpp:30:17: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
30 | for(auto[v,u] : U)
| ^
# | 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... |