# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
268233 | wdjpng | Split the Attractions (IOI19_split) | C++17 | 1 ms | 416 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>
#define lint long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
using namespace std;
const int maxn=200000;
vector<int>out;
bool vis[maxn];
int c=0;
vector<int>val(3);
vector<int>s;
vector<vector<int>>E;
void dfs(int i){
if(vis[i]){return;}
vis[i]=true;
c++;
if(c<=s[0]){
out[i]=val[0];
} else if(c<=s[0]+s[1]){
out[i]=val[1];
} else{
out[i]=val[2];
}
for(int w : E[i]){
dfs(w);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int>p, vector<int> q){
vector<int>s1={a,b,c};
s=s1;
sort(all(s));
out.resize(n);
E.resize(n);
rep(i, sizeof(p)){
E[p[i]].push_back(q[i]);
E[q[i]].push_back(p[i]);
}
rep(i, 3){
rep(j, 3){
if(s1[i]==s[j]){
val[j]=i+1;
}
}
}
dfs(0);
return out;
}
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... |