# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
605071 | OttoTheDino | Graph (BOI20_graph) | C++17 | 172 ms | 37852 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 rep(i,s,e) for (ll i = s; i <= e; ++i)
#define pb push_back
#define all(a) a.begin(), a.end()
#define len(a) (ll)a.size()
typedef long long ll;
typedef vector<pair<ll,ll>> vpll;
const ll mx = 3e5;
vpll cur, adj[mx+1];
ll coeff[mx+1], ans[mx+1], suc = 1, been[mx+1], c[mx+1];
set<ll> st;
void dfs (ll u, ll p) {
cur.pb({coeff[u], u});
for (auto [v,e] : adj[u]) {
if (e==p) continue;
if (been[v]) {
if (been[v]==been[u]) st.insert(been[u]*(c[e]-coeff[u]-coeff[v])/2);
else if (coeff[u]+coeff[v]!=c[e]) suc = 0;
continue;
}
been[v] = been[u]*-1;
coeff[v] = c[e]-coeff[u];
dfs (v,e);
}
}
# | 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... |