제출 #433527

#제출 시각아이디문제언어결과실행 시간메모리
433527JUANDI321Split the Attractions (IOI19_split)C++17
0 / 100
905 ms1048580 KiB
#include "split.h" #include <vector> using namespace std; vector<vector<int>> g(100100); vector<int> res(100100); int aa, bb, cc; void dfs(int node, int ant) { if(aa>0) { res[node]=1; aa--; } else if(bb>0) { res[node]=2; bb--; } else { res[node]=3; cc--; } for(int y : g[node]) { if(y!=ant) { dfs(y, node); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { aa = a; bb = b; cc = c; //vector<int> res; int m = p.size(); for(int i = 0; i<m; i++) { g[p[i]].push_back(q[i]); g[q[i]].push_back(p[i]); } int node =0; for(int i = 0; i<n; i++) { if(g[i].size()==1) { node = i; break; } } dfs(node, -1); return res; }
#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...