Submission #414563

#TimeUsernameProblemLanguageResultExecution timeMemory
414563mosiashvililukaMechanical Doll (IOI18_doll)C++14
2 / 100
33 ms2708 KiB
#include "doll.h" #include<bits/stdc++.h> using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,N,M,cnt,pas; vector <int> A,C,X,Y; /*void answer(std::vector<int> C, std::vector<int> X, std::vector<int> Y){ cout<<"C: "<<C.size()<<endl; for(i=0; i<C.size(); i++){ cout<<C[i]<<" "; } cout<<endl; cout<<"X: "<<X.size()<<endl; for(i=0; i<X.size(); i++){ cout<<X[i]<<" "; } cout<<endl; cout<<"Y: "<<Y.size()<<endl; for(i=0; i<Y.size(); i++){ cout<<Y[i]<<" "; } cout<<endl; exit(0); }*/ void rec(int q){ if(q==2){ cnt++; X.push_back(0); Y.push_back(0); c=1;d=1; C[1]=-1; X[0]=1;Y[0]=0; return; } if(q%2==0){ rec(q/2); cnt++; X.push_back(0); Y.push_back(0); X[cnt-1]=1;Y[cnt-1]=0; Y[d-1]=-cnt; d=cnt; }else{ rec(q-1); cnt+=2; X.push_back(0);X.push_back(0); Y.push_back(0);Y.push_back(0); X[cnt-1]=1;Y[cnt-1]=0; Y[d-1]=-cnt; X[cnt-2]=-c;Y[cnt-2]=-cnt; C[1]=-(cnt-1); c=cnt-1;d=cnt; } } void create_circuit(int M, vector<int> AA) { N=AA.size(); for(i=0; i<N; i++){ A.push_back(AA[i]); } C.resize(M+1); if(M==1&&N!=1){ C[0]=1; cnt=0; rec(N); answer(C,X,Y); }else{ C[0]=A[0]; for(i=0; i<N-1; i++){ C[A[i]]=A[i+1]; } C[A[N-1]]=0; answer(C,X,Y); } } /*int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>b>>a; vector <int> AA; for(i=1; i<=a; i++){ cin>>c; AA.push_back(c); } create_circuit(b,AA); return 0; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...