# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
411573 | ioi | Split the Attractions (IOI19_split) | C++14 | 89 ms | 12760 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;
int N ;
vector<int> adj[100005];
int vis[100005];
int A , B , C ;
vector<int> res ;
void dfs(int node){
vis[node] ++ ;
if(A)A -- , res[node] = 1 ;
else if(B)B -- , res[node] = 2 ;
else C -- , res[node] = 3 ;
for(auto f : adj[node]){
if(!vis[f])dfs(f);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
res.resize(n);
A = a , B = b , C = c ;
for(int i = 0 ; i < p.size() ; i ++)
adj[p[i]].push_back(q[i]) , adj[q[i]].push_back(p[i]);
dfs(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... |