제출 #335405

#제출 시각아이디문제언어결과실행 시간메모리
335405sofapuden자동 인형 (IOI18_doll)C++14
0 / 100
40 ms6344 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; void cr2(int la, vector<int> &X, vector<int> &Y, vector<int> &cur){ vector<int> p1, p2; for(int i = 0; i < cur.size(); ++i){ if(i&1)p2.push_back(cur[i]); else p1.push_back(cur[i]); } if(p1.size() == 1){ X.push_back(p1[0]); Y.push_back(0); } else{ X.push_back(-la-1); Y.push_back(0); cr2(la+1,X,Y,p1); } if(p2.size() == 1){ Y[la-1] = p2[0]; } else{ Y[la-1] = -(X.size()+1); cr2(X.size()+1,X,Y,p2); } return; } void create(int in, vector<int> &X, vector<int> &Y, vector<vector<int>> &v, vector<int> &c){ if(v[in].size() == 1){c[in] = v[in][0];return;} if(!v[in].size())return; c[in] = -(X.size()+1); cr2(X.size()+1,X,Y,v[in]); } void create_circuit(int m, vector<int> A) { int n = A.size(); vector<int> C(m + 1,0); vector<vector<int>> v(m+1); for(int i = 0; i < n; ++i){ if(!i)v[0].push_back(A[i]); else v[A[i-1]].push_back(A[i]); if(i == n-1)v[A[i]].push_back(0); } vector<int> X, Y; for(int i = 0; i <= n; ++i){ create(i,X,Y,v,C); } answer(C,X,Y); }

컴파일 시 표준 에러 (stderr) 메시지

doll.cpp: In function 'void cr2(int, std::vector<int>&, std::vector<int>&, std::vector<int>&)':
doll.cpp:8:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |  for(int i = 0; i < cur.size(); ++i){
      |                 ~~^~~~~~~~~~~~
#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...