Submission #717909

#TimeUsernameProblemLanguageResultExecution timeMemory
717909bebraSplit the Attractions (IOI19_split)C++17
0 / 100
65 ms10980 KiB
// #include "split.h" #include <bits/stdc++.h> using namespace std; using ll = long long; #define dbg(x) cerr << #x << ": " << x << endl; const int MAX_N = 1e5 + 5; vector<int> g[MAX_N]; bool used[MAX_N]; int color[MAX_N]; void dfs(int v, int cnt) { if (cnt == 0) { return; } --cnt; used[v] = true; color[v] = 2; for (auto u : g[v]) { if (used[u]) continue; dfs(u, cnt); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { int m = p.size(); for (int i = 0; i < m; ++i) { int u = p[i]; int v = q[i]; g[u].push_back(v); g[v].push_back(u); } dfs(0, b); bool f = false; for (int v = 0; v < n; ++v) { if (color[v] == 0 && !f) { color[v] = 1; f = true; } else if (color[v] == 0 && f) { color[v] = 3; } } vector<int> res(n); for (int i = 0; i < n; ++i) { res[i] = color[i]; } return res; } // int main() { // int n, m; // cin >> n >> m; // int a, b, c; // cin >> a >> b >> c; // vector<int> p(m), q(m); // for (int i = 0; i < m; ++i) { // cin >> p[i] >> q[i]; // } // for (auto x : find_split(n, a, b, c, p, q)) { // cout << x << ' '; // } // cout << '\n'; // }
#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...