# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1059951 | Unforgettablepl | Split the Attractions (IOI19_split) | C++17 | 50 ms | 12360 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> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
vector<int> res(n);
vector<bool> visited(n);
vector<vector<int>> adj(n);
for(int i=0;i<p.size();i++)adj[p[i]].emplace_back(q[i]);
for(int i=0;i<p.size();i++)adj[q[i]].emplace_back(p[i]);
vector<int> order;
function<void(int)> dfs = [&](int x) {
if(visited[x])return;
visited[x]=true;
order.emplace_back(x);
for(int&i:adj[x])dfs(i);
};
dfs(0);
for(int i=0;i<a;i++)res[i]=1;
for(int i=a;i<a+b;i++)res[i]=2;
for(int i=a+b;i<a+b+c;i++)res[i]=3;
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... |