Submission #430440

#TimeUsernameProblemLanguageResultExecution timeMemory
430440TheWilpMechanical Doll (IOI18_doll)C++14
0 / 100
394 ms262148 KiB
#include "doll.h" #include <iostream> #include <vector> int cnt = 1; std::vector<int> C; std::vector<int> X; std::vector<int> Y; void print_vector(std::vector<int>& v){ for(int q = 0 ;q<v.size();q++){ std::cout << v[q] << " "; }std::cout << std::endl; } int create(std::vector<int> v){ if(v.size() == 1) return v[0]; X.push_back(0);Y.push_back(0); int node_create = cnt++; 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]); } if(vleft.size() > vright.size()){ vright.push_back(vleft.back()); vleft.push_back(-node_create); } int get1 = create(vleft); int get2 = create(vright); X[node_create - 1] = get1; Y[node_create - 1] = get2; return -node_create; } void create_circuit(int M, std::vector<int> A) { A.push_back(0); for(int q = 0 ;q<=M;q++){ C.push_back(-1); } create(A); answer(C, X, Y); }

Compilation message (stderr)

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