제출 #156499

#제출 시각아이디문제언어결과실행 시간메모리
156499MoNsTeR_CuBeSplit the Attractions (IOI19_split)C++17
11 / 100
115 ms12636 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){ 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 < (int)p.size(); 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(colouring[i] == 2) continue; if(a){ 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...