# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
299142 | TMJN | Split the Attractions (IOI19_split) | C++17 | 124 ms | 12664 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<int>e[100000];
vector<int>find_split(int n,int a,int b,int c,vector<int>p,vector<int>q){
vector<int>res(n,0);
pair<int,int>P[3];
P[0]={a,1};
P[1]={b,2};
P[2]={c,3};
sort(P,P+3);
for(int i=0;i<p.size();i++){
e[p[i]].push_back(q[i]);
e[q[i]].push_back(p[i]);
}
if(P[0].first==1){
queue<int>que;
que.push(0);
while(P[1].first){
int x=que.front();
que.pop();
if(res[x])continue;
res[x]=P[1].second;
P[1].first--;
for(int i:e[x]){
que.push(i);
}
}
for(int i=0;i<n;i++){
if(!res[i]){
res[i]=P[0].second;
break;
}
}
for(int i=0;i<n;i++){
if(!res[i]){
res[i]=P[2].second;
}
}
}
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... |