# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
276323 | Toirov_Sadi | Split the Attractions (IOI19_split) | C++17 | 120 ms | 14500 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;
const int N = 1e5 + 7;
int used[N];
vector<int> g[N];
vector<int> t;
void dfs(int v){
used[v] = 1;
t.push_back(v);
for(auto to: g[v]){
if(used[to] == 0) dfs(to);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
for(int i = 0; i < (int)p.size(); i ++){
g[p[i]].push_back(q[i]);
g[q[i]].push_back(p[i]);
}
dfs(0);
int cur = 0;
vector<int> res(n);
for(int i = 0; i < (int)t.size(); i ++){
if(a --> 0){
res[t[i]] = 1;
}
else if(b --> 0){
res[t[i]] = 2;
}
else if(c --> 0){
res[t[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... |