# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
287755 | 2020-08-31T23:29:42 Z | Haunted_Cpp | Split the Attractions (IOI19_split) | C++17 | 127 ms | 14456 KB |
#include "split.h" #include <bits/stdc++.h> using namespace std; const int MAX_N = 1e5 + 5; bool vis[MAX_N]; vector<vector<int>> g(MAX_N); vector<int> euler; vector<int> ans; int k; void dfs(int node) { vis[node] = true; if (euler.size() < k) euler.emplace_back(node); for (auto to : g[node]) { if (!vis[to]) { vis[to] = true; dfs(to); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> in(n); k = b; ans = vector<int>(n, -1); const int m = p.size(); memset(vis, false, sizeof(vis)); for (int i = 0; i < m; i++) { int st = p[i]; int et = q[i]; g[st].emplace_back(et); g[et].emplace_back(st); } dfs(0); assert(euler.size() == b); for (auto to : euler) { ans[to] = 2; } for (int i = 0; i < n; i++) { if (ans[i] == -1) { if (a) { --a; ans[i] = 1; } else { ans[i] = 3; } } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2816 KB | ok, correct split |
2 | Correct | 2 ms | 2816 KB | ok, correct split |
3 | Correct | 2 ms | 2816 KB | ok, correct split |
4 | Correct | 2 ms | 2816 KB | ok, correct split |
5 | Correct | 2 ms | 2816 KB | ok, correct split |
6 | Incorrect | 2 ms | 2816 KB | 2 components are not connected |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2816 KB | ok, correct split |
2 | Correct | 2 ms | 2816 KB | ok, correct split |
3 | Correct | 2 ms | 2720 KB | ok, correct split |
4 | Correct | 109 ms | 13688 KB | ok, correct split |
5 | Correct | 77 ms | 10232 KB | ok, correct split |
6 | Correct | 93 ms | 14456 KB | ok, correct split |
7 | Correct | 88 ms | 13048 KB | ok, correct split |
8 | Correct | 127 ms | 13432 KB | ok, correct split |
9 | Correct | 93 ms | 10104 KB | ok, correct split |
10 | Correct | 59 ms | 10224 KB | ok, correct split |
11 | Correct | 58 ms | 10224 KB | ok, correct split |
12 | Correct | 59 ms | 10608 KB | ok, correct split |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2816 KB | ok, correct split |
2 | Incorrect | 74 ms | 10144 KB | 2 components are not connected |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2816 KB | 2 components are not connected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2816 KB | ok, correct split |
2 | Correct | 2 ms | 2816 KB | ok, correct split |
3 | Correct | 2 ms | 2816 KB | ok, correct split |
4 | Correct | 2 ms | 2816 KB | ok, correct split |
5 | Correct | 2 ms | 2816 KB | ok, correct split |
6 | Incorrect | 2 ms | 2816 KB | 2 components are not connected |
7 | Halted | 0 ms | 0 KB | - |