# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
118236 | songc | Designated Cities (JOI19_designated_cities) | C++14 | 696 ms | 46860 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;
typedef long long LL;
typedef pair<LL, int> pii;
int N, Q;
vector<pii> G[202020], RG[202020];
int deg[202020];
bool chk[202020];
LL ans[202020], sum;
priority_queue<pii> PQ;
LL d(int u, int p){
LL ret = 0;
for (pii v : RG[u]) if (v.second != p) ret += d(v.second, u) + v.first;
return ret;
}
void f(int u, int p){
ans[1] = min(ans[1], sum);
for (int i=0; i<(int)G[u].size(); i++){
if (G[u][i].second == p) continue;
sum -= RG[u][i].first;
sum += G[u][i].first;
f(G[u][i].second, u);
sum += RG[u][i].first;
sum -= G[u][i].first;
}
}
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |