# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1030747 | Zicrus | Split the Attractions (IOI19_split) | C++17 | 54 ms | 14516 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>
#include "split.h"
using namespace std;
typedef long long ll;
vector<vector<ll>> adj;
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
int m = p.size();
vector<int> res(n);
adj = vector<vector<ll>>(n);
for (int i = 0; i < m; i++) {
adj[p[i]].push_back(q[i]);
adj[q[i]].push_back(p[i]);
}
ll lowDeg = 0, deg = n;
for (int i = 0; i < n; i++) {
if (adj[i].size() < deg) {
lowDeg = i;
deg = adj[i].size();
}
}
queue<ll> qu;
qu.push(lowDeg);
while (!qu.empty()) {
ll node = qu.front(); qu.pop();
if (c) { res[node] = 3; c--; }
else if (b) { res[node] = 2; b--; }
else { res[node] = 1; }
for (auto &e : adj[node]) {
if (!res[e]) { qu.push(e); res[e] = 5; }
}
}
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... |