# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
374951 | S920105123 | Power Plant (JOI20_power) | C++14 | 216 ms | 38828 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define all_of(v) (v).begin(), (v).end()
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define fi first
#define se second
const int MAXN = 200005;
const LL INF = (LL) 1e9 + 8763;
//const LL MOD = (LL) 1e9 + 7;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, dp[MAXN][2], have[MAXN], ans = 0;
vector<int> G[MAXN];
void dfs(int v, int p) {
dp[v][0] = dp[v][1] = 0;
int maxv = 0, sum = 0, ch = 0;
for (int to : G[v]) {
if (to == p) continue;
dfs(to, v);
maxv = max({maxv, dp[to][0], dp[to][1] - 2 * have[to], have[to]});
sum += max({0, dp[to][0], dp[to][1] - 2 * have[to], have[to]});
ch++;
}
if (ch == 0) {
dp[v][0] = -have[v];
dp[v][1] = have[v];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |