# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
529052 | d2k05 | Power Plant (JOI20_power) | C++14 | 1571 ms | 34840 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>
#define fastio ios_base :: sync_with_stdio(0), cin.tie(0);
using namespace std;
using ll = long long;
const int mxN = 1e6 + 5, mod = 1e9 + 7;
int n, d[mxN], b[mxN], ans; string a;
vector <int> adj[mxN];
void calc(int v, int p = -1) {
int cnt = 0;
for (auto to : adj[v]) {
if (to != p) {
calc(to, v);
if (d[to] > 0)
++cnt;
d[v] += d[to];
}
}
if (cnt <= 1 && p == -1)
d[v] += a[v - 1];
else {
if (d[v] > 0)
d[v] -= a[v - 1];
if (!d[v])
d[v] = a[v - 1];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |