이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int z,x,d,e,ka[10],zx,m,la[100009];
vector <int> pas,v[100009];
bool bo[100009];
void dfs(int w){
if(ka[zx]==0) return;
bo[w]=1;
pas[w]=zx;
ka[zx]--;
if(ka[zx]==0) return;
for(vector <int>::iterator it=v[w].begin(); it!=v[w].end(); it++){
if(bo[(*it)]==1) continue;
dfs((*it));
if(ka[zx]==0) return;
}
}
vector <int> find_split(int n, int a, int b, int c, vector <int> p, vector <int> q){
pas.resize(n);
ka[1]=a;
ka[2]=b;
ka[3]=c;
zx=0;
m=p.size();
for(int h=0; h<m; h++){
v[p[h]].push_back(q[h]);
v[q[h]].push_back(p[h]);
}
for(int h=1; h<=n; h++) la[h]=h;
for(int h=1; h<=n; h++){
if(v[h].size()==1){
zx++;
swap(la[zx],la[h]);
}
}
zx=0;
for(int h=1; h<=n; h++){
if(bo[h]==0){
zx++;
dfs(h);
}
}
return pas;
}
# | 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... |