Submission #583697

#TimeUsernameProblemLanguageResultExecution timeMemory
583697joelauSplit the Attractions (IOI19_split)C++14
7 / 100
94 ms9624 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; int N,M,A,B,C, deg[100005]; vector<int> lst[100005], ans; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { N = n, M = p.size(), A = a, B = b, C = c; memset(deg,0,sizeof(deg)); for (int i = 0; i < M; ++i) lst[p[i]].push_back(q[i]), lst[q[i]].push_back(p[i]); int root = 0; for (int i = 0; i < N; ++i) if (lst[i].size() == 1) root = i; ans.assign(N,0); for (int i = 0; i < N; ++i) { if (i < A) ans[root] = 1; else if (i < A+B) ans[root] = 2; else ans[root] = 3; if (i != N-1) { if (ans[lst[root][0]] == 0) root = lst[root][0]; else root = lst[root][1]; } } 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...