# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1055335 | Ahmed57 | Mechanical Doll (IOI18_doll) | C++17 | 73 ms | 13980 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;
int S = -1;
vector<int> X,Y,C;
vector<int> dc(vector<int> lol){
if(lol.size()==1)return lol;
int sz = lol.size();
int add = sz/2;
vector<int> ret;
for(int j = 0;j+add<sz;j++){
if(lol[j]==-1e9&&lol[j+add]==-1e9){
ret.push_back(-1e9);
continue;
}
if(lol[j]==-1e9)X.push_back(-1e9);
else X.push_back(lol[j]);
Y.push_back(lol[j+add]);
ret.push_back(S--);
}
return dc(ret);
}
void create_circuit(int M, vector<int> A){
S = -1;
X.clear();
Y.clear();
C.clear();
vector<int> adj[M+1];
int N = A.size();
vector<int> lo;
for(int i = 1;i<N;i++){
lo.push_back(A[i]);
}
lo.push_back(0);
int rem = 1;
while(rem<lo.size())rem*=2;
vector<int> fin;
while(rem>lo.size()){fin.push_back(-1e9);rem--;}
for(auto i:lo)fin.push_back(i);
vector<int> e = dc(fin);
C.push_back(A[0]);
for(int i = 0;i<X.size();i++){
if(X[i]==-1e9)X[i] = e[0];
if(Y[i]==-1e9)Y[i] = e[0];
}
for(int i = 1;i<=M;i++){
if(rem==0)C.push_back(0);
else C.push_back(e[0]);
}
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... |