Submission #605071

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6050712022-07-25 12:44:43OttoTheDinoGraph (BOI20_graph)C++17
100 / 100
172 ms37852 KiB
#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);
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...