# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
301955 | NicolaAbusaad2014 | Split the Attractions (IOI19_split) | C++14 | 690 ms | 1048580 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<vector<long> >edges;
long z=1,x=0;
vector<int>ans;
long arr[3];
void solve(long n,long p)
{
if(arr[x]==0){
x++;
}
arr[x]--;
ans[n]=x+1;
for(long i=0;i<edges[n].size();i++){
if(edges[n][i]!=p){
solve(edges[n][i],n);
}
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
edges.resize(n);
ans.resize(n);
for(long i=0;i<p.size();i++){
edges[p[i]].push_back(q[i]);
edges[q[i]].push_back(p[i]);
}
arr[0]=a;
arr[1]=b;
arr[2]=c;
solve(0,-1);
return ans;
}
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... |