# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1170384 | rayan_bd | Dreaming (IOI13_dreaming) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include "dreaming.h"
using namespace std;
#define ll long long
#define show(n) cout<<n<<'\n'
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
const int INF = 2e9;
const int mxN = 1e5 + 5000;
vector<pair<int,int>> adj[mxN];
bool vis[mxN];
int tot=0;
void dfs(int u,int par,int w,int &c){
c=min(c,max(w,tot-w));
vis[u]=1;
for(auto it:adj[u]){
if(it.fi^par){
dfs(it.fi,u,w+it.se,c);
}
}
}
void calc_tot(int u,int par){