Submission #832112

#TimeUsernameProblemLanguageResultExecution timeMemory
832112maomao90Split the Attractions (IOI19_split)C++17
0 / 100
51 ms10524 KiB
// I can do all things through Christ who strengthens me // Philippians 4:13 #include "split.h" #include "bits/stdc++.h" using namespace std; #define REP(i, j, k) for (int i = j; i < (k); i++) #define RREP(i, j, k) for (int i = j; i >= (k); i--) template <class T> inline bool mnto(T &a, const T b) {return a > b ? a = b, 1 : 0;} template <class T> inline bool mxto(T &a, const T b) {return a < b ? a = b, 1 : 0;} typedef long long ll; typedef long double ld; #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; #define SZ(x) (int) x.size() #define ALL(x) x.begin(), x.end() #define pb push_back typedef vector<int> vi; typedef vector<ii> vii; typedef vector<ll> vll; typedef tuple<int, int, int> iii; typedef vector<iii> viii; #ifndef DEBUG #define cerr if (0) cerr #endif const int INF = 1000000005; const ll LINF = 1000000000000000005; const int MAXN = 100005; int n, m, a, b, c; vi adj[MAXN]; vi find_split(int n, int a, int b, int c, vi p, vi q) { ::n = n; ::a = a; ::b = b; ::c = c; m = SZ(p); REP (i, 0, m) { adj[p[i]].pb(q[i]); adj[q[i]].pb(p[i]); } int rt = 0; REP (i, 0, n) { if (SZ(adj[i]) == 1) { rt = i; break; } } vi ans(n, 3); REP (z, 0, a) { ans[rt] = 1; for (int v : adj[rt]) { if (ans[v] == 3) { rt = v; break; } } } for (int v : adj[rt]) { if (ans[v] == 3) { rt = v; break; } } REP (z, 0, b) { ans[rt] = 2; for (int v : adj[rt]) { if (ans[v] == 3) { rt = v; break; } } } return ans; }
#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...