# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080503 | speedcode | Split the Attractions (IOI19_split) | C++17 | 52 ms | 12892 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 <bits/stdc++.h>
using namespace std;
std::vector<int> find_split(int n, int a, int b, int c, std::vector<int> p, std::vector<int> q){
if(a!=1) {
cout << "jksjkfd";
return {};
}
vector<vector<int>> graphe(n);
for(int i = 0; i < p.size(); i++){
graphe[p[i]].push_back(q[i]);
graphe[q[i]].push_back(p[i]);
}
vector<int> result(n);
vector<int> explored(n);
fill(result.begin(), result.end(), 3);
fill(explored.begin(), explored.end(), 0);
int B = b;
queue<int> bfs;
bfs.push(0);
explored[0] = 1;
while(!bfs.empty() && B--) {
int u = bfs.front();
bfs.pop();
result[u] = 2;
for(int v : graphe[u]) {
if(!explored[v]) {
explored[v] = 1;
bfs.push(v);
}
}
}
for(int i = 0; i < n; i++) {
if(result[i] == 3) {
result[i] = 1;
break;
}
}
return result;
}
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... |