Submission #954858

#TimeUsernameProblemLanguageResultExecution timeMemory
954858Trisanu_DasMechanical Doll (IOI18_doll)C++17
53 / 100
115 ms17620 KiB
#include "doll.h" #include <bits/stdc++.h> std::vector < int > X,Y,C,nx[100005]; void build(int stt,std::vector < int > tar){ X.push_back(0); Y.push_back(0); std::vector < int > G[2]; int i,j,k; for(i=0;i<(int)tar.size();++i){ G[i&1].push_back(tar[i]); } if((int)tar.size()&1){ G[1].push_back(tar.back()); G[0].back()=-stt-1; } for(i=0;i<2;++i){ int *T=(i?&Y[stt]:&X[stt]); if((int)G[i].size()==1) *T=G[i][0]; else{ *T=-(int)X.size()-1; build((int)X.size(),G[i]); } } } void create_circuit(int M, std::vector<int> A) { C.resize(M+1); int i,j,k; for(i=0;i<(int)A.size();++i){ nx[A[i]].push_back(i==((int)A.size()-1)?0:A[i+1]); } C[0]=A[0]; X.clear(); Y.clear(); for(i=1;i<=M;++i){ if(nx[i].size()==0) C[i]=i; else if(nx[i].size()==1) C[i]=nx[i][0]; else{ C[i]=-(int)X.size()-1; build((int)X.size(),nx[i]); } } answer(C, X, Y); }

Compilation message (stderr)

doll.cpp: In function 'void build(int, std::vector<int>)':
doll.cpp:8:8: warning: unused variable 'j' [-Wunused-variable]
    8 |  int i,j,k;
      |        ^
doll.cpp:8:10: warning: unused variable 'k' [-Wunused-variable]
    8 |  int i,j,k;
      |          ^
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:28:8: warning: unused variable 'j' [-Wunused-variable]
   28 |  int i,j,k;
      |        ^
doll.cpp:28:10: warning: unused variable 'k' [-Wunused-variable]
   28 |  int i,j,k;
      |          ^
#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...