Submission #1077684

#TimeUsernameProblemLanguageResultExecution timeMemory
1077684IgnutSplit the Attractions (IOI19_split)C++17
0 / 100
45 ms11748 KiB
// Ignut #include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 123; int n; int a, b, c; int colorA = 1, colorB = 2, colorC = 3; vector<int> g[MAXN]; int vert = -1; vector<int> res; int lim; void dfs(int v, int col) { res[v] = col; lim --; if (lim == 0) return; for (int to : g[v]) { if (res[to] != 3) continue; if (lim == 0) return; dfs(to, col); if (lim == 0) return; } } 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 ++) { g[P[i]].push_back(Q[i]); g[Q[i]].push_back(P[i]); } res.assign(N, 3); vector<pair<int, int>> vec; for (int i = 0; i < N; i ++) vec.push_back({g[i].size(), i}); vert = vec[0].second; res[vert] = 1; int start = 0; if (start == vert) start ++; lim = B; dfs(start, 2); 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...