제출 #583696

#제출 시각아이디문제언어결과실행 시간메모리
583696joelauSplit the Attractions (IOI19_split)C++14
0 / 100
45 ms8564 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 = -1; 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...