# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
821803 | tch1cherin | Love Polygon (BOI18_polygon) | C++17 | 290 ms | 34796 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;
const int MAX_N = 1e5 + 5;
vector<int> G[MAX_N], comp;
bool vis[MAX_N] = {};
int dp[MAX_N][2] = {};
void DFS(int u, pair<int, int> edge = {-1, -1}) {
vis[u] = true;
dp[u][0] = dp[u][1] = 0;
vector<int> children;
for (int v : G[u]) {
if (u == edge.first && v == edge.second) {
continue;
}
if (v == edge.first && u == edge.second) {
continue;
}
if (!vis[v]) {
children.push_back(v);
DFS(v, edge);
dp[u][0] += max(dp[v][0], dp[v][1]);
}
}
dp[u][1] = dp[u][0];
for (int v : children) {
if (u == edge.first && v == edge.second) {
continue;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |