Submission #156493

#TimeUsernameProblemLanguageResultExecution timeMemory
156493MoNsTeR_CuBeSplit the Attractions (IOI19_split)C++17
0 / 100
3 ms504 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; vector< vector< int > > Graph; vector< int > colouring; vector< bool > visited; int remaining; void dfs(int node){ visited[node] = true; if(remaining--) colouring[node] = 2; for(int a : Graph[node]){ if(visited[a]) continue; dfs(a); } } vector<int> find_split(int N, int a, int b, int c, vector<int> p, vector<int> q) { Graph.resize(N); colouring.resize(N); visited.assign(N, false); remaining = b; for(int i = 0; i < N; i++){ Graph[p[i]].push_back(q[i]); Graph[q[i]].push_back(p[i]); } dfs(0); for(int i = 0; i < N; i++){ if(a--) colouring[i] = 1; else colouring[i] = 3; } return colouring; }
#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...