제출 #125378

#제출 시각아이디문제언어결과실행 시간메모리
125378teomrn자동 인형 (IOI18_doll)C++14
47 / 100
130 ms14788 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; const int NMAX = 200010; vector <int> X, Y, C; int n, m; vector <int> urm[NMAX], act; vector <int> build_ord(int h) { if (h == 0) return { 0 }; auto x = build_ord(h - 1); auto y = x; for (auto & i : x) i *= 2; for (auto & i : y) i = 2 * i + 1; for (auto i : y) x.push_back(i); return x; } int build_switch(int h, int from, vector <int> & fii) { if (h != 0) { int nod = X.size() + 1; X.push_back(0); Y.push_back(0); int st = build_switch(h - 1, from, fii); int dr = build_switch(h - 1, from + (1 << (h - 1)), fii); X[nod - 1] = st; Y[nod - 1] = dr; return -nod; } return fii[from]; } void create_circuit(int M, std::vector<int> A) { n = A.size(), m = M; A.push_back(0); C.resize(m + 1); C[0] = A[0]; int root = -1; int h = 0; while ((1 << h) < n) h++; auto ord = build_ord(h); int dec = ord.size() - n; for (auto & i : ord) { if (i < dec) i = root; else { assert(i - dec + 1 < A.size()); i = A[i - dec + 1]; } } fill(C.begin() + 1, C.end(), build_switch(h, 0, ord)); answer(C, X, Y); }

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

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from doll.cpp:2:
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:60:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |    assert(i - dec + 1 < A.size());
      |           ~~~~~~~~~~~~^~~~~~~~~~
#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...