Submission #601865

#TimeUsernameProblemLanguageResultExecution timeMemory
601865Minindu2006Split the Attractions (IOI19_split)C++14
0 / 100
465 ms1048576 KiB
#include<bits/stdc++.h> using namespace std; const int MX = 1e5 + 1; int pathC = 0; vector<int> adj[MX], vis(MX, 0); void dfs(int i, vector<int> &res, int a, int b) { vis[i] = 1; if(pathC < a) res[i] = 1; else if(pathC < a + b) res[i] = 2; pathC++; for(auto a:adj[i]) { if(!vis[a]) dfs(i, res, a, b); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> res(n, 3); int m = p.size(); for(int i=0;i<m;i++) { adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } int root = -1; for(int i=0;i<n;i++) if(adj[i].size() == 1) { root = i; break; } root = max(root, 0); dfs(root, res,a , b); 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...