제출 #260908

#제출 시각아이디문제언어결과실행 시간메모리
260908Alexa2001자동 인형 (IOI18_doll)C++17
10 / 100
2 ms368 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; vector<int> x, y, c; vector<bool> state; int n, k, e, nodes = 1; void create_tree(int node, int sz) { if(sz == 2) { if(e & 1) { x[node] = 1; y[node] = 0; } else x[node] = y[node] = 0; return; } if(e & (sz/2)) x[node] = 1; else { x[node] = ++nodes; create_tree(nodes, sz/2); } y[node] = ++nodes; create_tree(nodes, sz/2); } void place(int number, int node = 1) { if(state[node] == 0) { state[node] = 1; if(x[node] == 0) { x[node] = number; return; } else place(number, x[node]); } else { state[node] = 0; if(y[node] == 0) { y[node] = number; return; } else place(number, y[node]); } } void create_circuit(int M, vector<int> A) { n = A.size(); c.resize(M+1); x.resize(10*n); y.resize(10*n); state.resize(10*n); for(k=1; (1<<k) < n; ++k); e = (1<<k) - n; create_tree(1, (1<<k)); int i; for(i=1; i<n; ++i) place(-A[i]); place(0); for(i=1; i<=nodes; ++i) x[i] = -x[i], y[i] = -y[i]; c[0] = A[0]; for(i=1; i<=M; ++i) c[i] = -1; x.erase(x.begin()); y.erase(y.begin()); while(x.size() > nodes) x.pop_back(); while(y.size() > nodes) y.pop_back(); answer(c, x, y); }

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

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:96:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   96 |     while(x.size() > nodes) x.pop_back();
      |           ~~~~~~~~~^~~~~~~
doll.cpp:97:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   97 |     while(y.size() > nodes) y.pop_back();
      |           ~~~~~~~~~^~~~~~~
#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...