Submission #395376

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3953762021-04-28 09:51:24KoDVillage (BOI20_village)C++17
75 / 100
170 ms22720 KiB
#include <bits/stdc++.h>
template <class T>
using Vec = std::vector<T>;
int main() {
int N;
std::cin >> N;
Vec<Vec<int>> graph(N);
for (int i = 0; i < N - 1; ++i) {
int a, b;
std::cin >> a >> b;
a -= 1;
b -= 1;
graph[a].push_back(b);
graph[b].push_back(a);
}
int min = -1, max = -1;
Vec<int> min_v(N), max_v(N);
// minimum
{
Vec<std::pair<int, int>> use;
auto dfs = [&](auto&& dfs, const int u, const int p) -> bool {
int child = -1;
bool done = false;
for (const int v: graph[u]) {
if (v != p) {
if (dfs(dfs, v, u)) {
done = true;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

Village.cpp: In function 'int main()':
Village.cpp:118:32: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  118 |                     (up.size() < N / 2 ? up : down).push_back(u);
      |                      ~~~~~~~~~~^~~~~~~
Village.cpp:130:32: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  130 |                     (up.size() < (N - 1) / 2 ? up : down).push_back(u);
      |                      ~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...