# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
412851 | Ahmadsm2005 | Mechanical Doll (IOI18_doll) | C++14 | 0 ms | 0 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 "grader.cpp"
#include<bits/stdc++.h>
using namespace std;
void create_circuit(int M,vector<int>A){
int N = A.size();
vector<int> C(M + 1);
C[0] = -1;
for (int i = 1; i <= M; ++i) {
C[i] = -1;
}
vector<int>X,Y;
string s;
while(N){
s+=('0'+N%2);
N/=2;
}
reverse(s.begin(),s.end());
for(int i=0;i<s.size();i++){
if(s[i]=='1')
X.push_back(1);
else
X.push_back(-1);
if(i+1!=s.size())
Y.push_back((-i)-2);
}
Y.push_back(0);
/*for(int i=0;i<X.size();i++)
cout<<X[i]<<' ';
cout<<endl;
for(int i=0;i<Y.size();i++)
cout<<Y[i]<<' ';*/
answer(C, X, Y);
}