# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
112237 | thebes | Designated Cities (JOI19_designated_cities) | C++14 | 705 ms | 41764 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;
const int MN = 2e5+5;
ll N, Q, i, ans[MN], tot, cur, x, y, a, b, dist[MN], w[2*MN], par[MN];
vector<pair<ll,ll>> adj[MN], ord;
struct pq{bool operator()(const pair<ll,ll>&i,const pair<ll,ll>&j){return i.second>j.second;}};
priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,pq> q;
ll meh(ll n,ll p){
ll cur = 0;
for(auto v : adj[n]){
if(v.first==p) continue;
cur+=w[v.second^1]+meh(v.first,n);
}
return cur;
}
void dfs(ll n,ll p){
ans[1]=max(ans[1],cur);
for(auto v : adj[n]){
if(v.first==p) continue;
cur += w[v.second]-w[v.second^1]; dfs(v.first,n);
cur -= w[v.second]-w[v.second^1];
}
}
pair<ll,ll> dfs2(ll n,ll p){
pair<ll,ll> tmp(n,0);
for(auto v : adj[n]){
if(v.first==p) continue;
auto tt = dfs2(v.first, n);
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... |