# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
644424 | a_aguilo | Split the Attractions (IOI19_split) | C++14 | 0 ms | 300 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"
#include<bits/stdc++.h>
using namespace std;
vector<int> res;
vector<vector<int>> listaAdy;
int cnt, A, B, C;
void dfs(int node){
//cout << node << endl;
if(cnt <= A) res[node] = 1;
else if (cnt <= B) res[node] = 2;
else res[node] = 3;
cnt++;
for(int neighbour: listaAdy[node]){
if(res[neighbour] == -1) dfs(neighbour);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
res = vector<int>(n, -1);
A = a;
B = b;
C = c;
listaAdy = vector<vector<int>> (n);
for(int i = 0; i < p.size(); ++i){
listaAdy[p[i]].push_back(q[i]);
listaAdy[q[i]].push_back(p[i]);
}
int start = -1;
for(int i = 0; i < n; ++i){
if(listaAdy[i].size() <= 1){
start = i;
break;
}
}
cnt = 1;
dfs(start);
//cout << "a "<< endl;
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... |