제출 #430286

#제출 시각아이디문제언어결과실행 시간메모리
430286TheWilp자동 인형 (IOI18_doll)C++14
53 / 100
254 ms17836 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]); } if(vleft.size() > vright.size()){ vright.push_back(vleft.back()); vleft.back() = -node_create; } 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) { f[0].push_back(A[0]); for(int q = 1;q<A.size();q++){ f[A[q - 1]].push_back(A[q]); } f[A.back()].push_back(0); for(int q = 0;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); }

컴파일 시 표준 에러 (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:33:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int q = 0 ;q<v.size();q++){
      |                    ~^~~~~~~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:39:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     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...