제출 #699738

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6997382023-02-17 21:38:31finn__Ball Machine (BOI13_ballmachine)C++17
66.29 / 100
121 ms53436 KiB
#include <bits/stdc++.h>
using namespace std;
#define N 100000
vector<unsigned> g[N], anc[N];
unsigned min_child[N], postorder[N];
bitset<N> has_ball;
unsigned calc_min_child(unsigned u)
{
min_child[u] = u;
for (unsigned const &v : g[u])
min_child[u] = min(min_child[u], calc_min_child(v));
return min_child[u];
}
unsigned traverse(unsigned u, vector<unsigned> &path, unsigned i = 0)
{
for (size_t j = 1; j <= path.size(); j <<= 1)
anc[u].push_back(path[path.size() - j]);
path.push_back(u);
for (unsigned const &v : g[u])
i = traverse(v, path, i);
path.pop_back();
postorder[u] = i++;
return i;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

ballmachine.cpp: In function 'int main()':
ballmachine.cpp:57:20: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
   57 |     assert(traverse(r, path) == n);
      |                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...