# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
521018 | Valaki2 | Split the Attractions (IOI19_split) | C++14 | 82 ms | 10728 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "split.h"
using namespace std;
#include <iostream>
/*
10 9
3 5 2
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 0
*/
int hatra;
vector<int> res;
vector<vector<int> > g;
void dfs(int x) {
if(!hatra) return;
hatra--;
res[x] = 2;
for(int y : g[x]) {
if(res[y] == 3) {
dfs(y);
}
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
res.assign(n, 3);
g.resize(n);
for(int i = 0; i < p.size(); i++) {
g[p[i]].push_back(q[i]);
g[q[i]].push_back(p[i]);
}
hatra = b;
dfs(1);
for(int i = 0; i < n; i++) {
if(res[i] == 3) {
res[i] = 1;
break;
}
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |