| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 520990 | Valaki2 | Split the Attractions (IOI19_split) | C++14 | 1 ms | 280 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;
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
vector<int> res(n, 3);
vector<vector<int> > g(n);
for(int i = 0; i < p.size(); i++) {
g[p[i]].push_back(q[i]);
g[q[i]].push_back(p[i]);
}
bool volt = false;
for(int i = 0; i < n; i++) {
if(g[i].size() == 1) {
volt = true;
int x = i, y = g[x][0];
for(int j = 0; j < a; j++) {
res[x] = 1;
int temp = x;
if(g[x][0] == y) {
x = g[x][1];
} else {
x = g[x][0];
}
y = temp;
}
for(int j = 0; j < b; j++) {
res[x] = 2;
int temp = x;
if(g[x][0] == y) {
x = g[x][1];
} else {
x = g[x][0];
}
y = temp;
}
}
}
if(!volt) {
int x = 0, y = -1;
for(int j = 0; j < a; j++) {
res[x] = 1;
int temp = x;
if(g[x][0] == y) {
x = g[x][1];
} else {
x = g[x][0];
}
y = temp;
}
for(int j = 0; j < b; j++) {
res[x] = 2;
int temp = x;
if(g[x][0] == y) {
x = g[x][1];
} else {
x = g[x][0];
}
y = temp;
}
}
/*if (n == 9) {
res = {1, 1, 3, 1, 2, 2, 3, 1, 3};
} else {
res = {0, 0, 0, 0, 0, 0};
}*/
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... | ||||
