# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
291104 | Pichon5 | Split the Attractions (IOI19_split) | C++17 | 120 ms | 13428 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"
#define vi vector<int>
#define pb push_back
#define F first
using namespace std;
vector<vector<int> >G;
vector<bool>vis;
vi res;
vi v;
void dfs(int u){
vis[u]=true;
v.pb(u);
for(int i=0;i<G[u].size();i++){
if(vis[G[u][i]]==true){
continue;
}
dfs(G[u][i]);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
G.assign(n,vector<int>());
for(int i=0;i<p.size();i++){
G[p[i]].pb(q[i]);
G[q[i]].pb(p[i]);
}
res.resize(n);
vis.assign(n,false);
dfs(0);
for(int i=0;i<n;i++){
if(a>0){
res[v[i]]=1;
a--;
continue;
}
if(b>0){
res[v[i]]=2;
b--;
continue;
}
res[v[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... |