# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
528552 | couplefire | Parkovi (COCI22_parkovi) | C++17 | 1014 ms | 34980 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;
#define ll long long
#define pii pair<int, int>
#define f first
#define s second
const int N = 200005;
int n, k;
vector<pii> adj[N];
bool vis[N], park[N];
ll dfs(int v, int p, ll mid){
if(v!=0 && (int)adj[v].size()==1)
return 0;
ll mn = 1e16, mx = -1e16;
for(auto [u, w] : adj[v]){
if(u==p) continue;
ll val = dfs(u, v, mid);
if(val==0ll && vis[u]){
mn = min(mn, 0ll);
mx = max(mx, 0ll);
continue;
}
if(val+w<=0ll) vis[v] = 1, val += w;
else if(val<0ll) val = 0;
else val += w;
if(val>mid){
park[u] = 1;
# | 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... |