# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
838842 | JellyTheOctopus | Papričice (COCI20_papricice) | C++17 | 4 ms | 4948 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int MOD = 1e9+7;
int N;
vector<int> adjList[200001];
int upper[200001];
int lower[200001];
int ans = (1<<30);
void DFS(int node, int parent) {
set<int> s;
int total = 1;
for (auto child: adjList[node]) {
if (child == parent) continue;
DFS(child, node);
total += upper[child]+lower[child];
}
upper[node] = total;
for (auto child: adjList[node]) {
if (child == parent) continue;
if (total-(upper[child]+lower[child]) < abs(upper[node]-lower[node])
|| (total-(upper[child]+lower[child]) == abs(upper[node]-lower[node])
&& total-(upper[child]+lower[child]) <= upper[child]+lower[child])) {
upper[node] = total-(upper[child]+lower[child]);
lower[node] = upper[child]+lower[child];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |