제출 #330480

#제출 시각아이디문제언어결과실행 시간메모리
330480aquablitz11자동 인형 (IOI18_doll)C++14
47 / 100
151 ms11868 KiB
#include <bits/stdc++.h> #include "doll.h" using namespace std; const int INF = 2e9; vector<int> C, X, Y; int cnt = 0; int get_switch(int x, int y) { X.push_back(x); Y.push_back(y); return --cnt; } int create_tree(const vector<int> &v) { if (v.size() == 1) return v[0]; vector<int> vx, vy; for (int i = 0; i < v.size(); ++i) { if (i % 2 == 0) vx.push_back(v[i]); else vy.push_back(v[i]); } int x = create_tree(vx); int y = create_tree(vy); return get_switch(x, y); } void create_circuit(int M, vector<int> A) { int n = A.size(); int k = 0; while ((1<<k) < n) ++k; n = 1<<k; vector<int> v(A.begin()+1, A.end()); v.resize(n, INF); v[n-1] = 0; int r = create_tree(v); C = vector<int>(M+1, r); C[0] = A[0]; for (auto &x: X) { if (x == INF) x = r; } for (auto &y: Y) { if (y == INF) y = r; } answer(C, X, Y); }

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

doll.cpp: In function 'int create_tree(const std::vector<int>&)':
doll.cpp:20:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (int i = 0; i < v.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...