Submission #732069

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7320692023-04-28 10:51:54ollelNetwork (BOI15_net)C++17
18 / 100
1 ms340 KiB
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
typedef vector<int> vi;
typedef vector<vi> vvi;
#define pb push_back
#define rep(i,a,b) for(int i = a; i < b; i++)
int n;
vvi g;
vi leaf;
int total_leafs;
vvi groups;
void dfs(int x, int p) {
for (auto y : g[x]) {
if (y == p) continue;
dfs(y, x);
leaf[x] += leaf[y];
}
}
bool test(int r) {
if (g[r].size() == 1) return false;
for (auto y : g[r]) if (leaf[y] <= leaf[r]) if (leaf[y] > total_leafs / 2) return false;
if (total_leafs - leaf[r] > total_leafs / 2) return false;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...