Submission #430241

#TimeUsernameProblemLanguageResultExecution timeMemory
430241TheWilpMechanical Doll (IOI18_doll)C++14
6 / 100
117 ms12048 KiB
#include "doll.h" #include <vector> #include <iostream> std::vector<int> f[100005]; int cnt = 1; std::vector<int> C; std::vector<int> X; std::vector<int> Y; int create(int pos,std::vector<int> v){ if(v.size() == 1) return v[0]; int node_create = cnt++; X.push_back(0);Y.push_back(0); std::vector<int> vleft; std::vector<int> vright; for(int q = 0 ;q<v.size();q+=2){ vleft.push_back(v[q]); } for(int q = 1;q<v.size();q+=2){ vright.push_back(v[q]); } int get1 = create(pos,vleft); int get2 = create(pos,vright); X[node_create - 1] = get1; Y[node_create - 1] = get2; return -node_create; } void print_vector(std::vector<int>& v){ for(int q = 0 ;q<v.size();q++){ std::cout << v[q] << " "; }std::cout << std::endl; } void create_circuit(int M, std::vector<int> A) { for(int q = 1;q<A.size();q++){ f[A[q - 1]].push_back(A[q]); } f[A.back()].push_back(0); C.push_back(A[0]); for(int q = 1 ;q<=M;q++){ if(f[q].size() == 0) C.push_back(0); else C.push_back(create(q,f[q])); } //print_vector(C); //print_vector(X); //print_vector(Y); answer(C,X,Y); }

Compilation message (stderr)

doll.cpp: In function 'int create(int, std::vector<int>)':
doll.cpp:16:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |    for(int q = 0 ;q<v.size();q+=2){
      |                   ~^~~~~~~~~
doll.cpp:19:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |    for(int q = 1;q<v.size();q+=2){
      |                  ~^~~~~~~~~
doll.cpp: In function 'void print_vector(std::vector<int>&)':
doll.cpp:29:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int q = 0 ;q<v.size();q++){
      |                    ~^~~~~~~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:34:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int q = 1;q<A.size();q++){
      |                   ~^~~~~~~~~
#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...