#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]);
}
zx=0;
for(d=0; d<n; d++){
if(v[d].size()!=1) continue;
if(bo[d]==0){
zx++;
dfs(d);
}
}
if(zx!=0){
for(d=0; d<n; d++) if(pas[d]==0) pas[d]=3;
}else{
zx=0;
for(d=0; d<n; d++){
if(bo[d]==0){
zx++;
dfs(d);
break;
}
}
for(d=0; d<n; d++){
if(bo[d]==1){
for(vector <int>::iterator it=v[d].begin(); it!=v[d].end(); it++){
if(bo[(*it)]==1) continue;
zx++;
dfs((*it));
break;
}
if(zx==2) break;
}
}
for(d=0; d<n; d++){
if(bo[d]==0){
zx++;
dfs(d);
break;
}
}
}
return pas;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2680 KB |
ok, correct split |
2 |
Correct |
4 ms |
2680 KB |
ok, correct split |
3 |
Correct |
4 ms |
2680 KB |
ok, correct split |
4 |
Correct |
4 ms |
2680 KB |
ok, correct split |
5 |
Correct |
4 ms |
2680 KB |
ok, correct split |
6 |
Correct |
4 ms |
2680 KB |
ok, correct split |
7 |
Correct |
79 ms |
10488 KB |
ok, correct split |
8 |
Correct |
92 ms |
12664 KB |
ok, correct split |
9 |
Correct |
91 ms |
11000 KB |
ok, correct split |
10 |
Correct |
116 ms |
12240 KB |
ok, correct split |
11 |
Correct |
81 ms |
10488 KB |
ok, correct split |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2680 KB |
ok, correct split |
2 |
Correct |
4 ms |
2680 KB |
ok, correct split |
3 |
Incorrect |
4 ms |
2680 KB |
invalid split: #1=1, #2=0, #3=4 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2680 KB |
ok, correct split |
2 |
Runtime error |
88 ms |
12344 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
2680 KB |
invalid split: #1=4, #2=1, #3=4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2680 KB |
ok, correct split |
2 |
Correct |
4 ms |
2680 KB |
ok, correct split |
3 |
Correct |
4 ms |
2680 KB |
ok, correct split |
4 |
Correct |
4 ms |
2680 KB |
ok, correct split |
5 |
Correct |
4 ms |
2680 KB |
ok, correct split |
6 |
Correct |
4 ms |
2680 KB |
ok, correct split |
7 |
Correct |
79 ms |
10488 KB |
ok, correct split |
8 |
Correct |
92 ms |
12664 KB |
ok, correct split |
9 |
Correct |
91 ms |
11000 KB |
ok, correct split |
10 |
Correct |
116 ms |
12240 KB |
ok, correct split |
11 |
Correct |
81 ms |
10488 KB |
ok, correct split |
12 |
Correct |
4 ms |
2680 KB |
ok, correct split |
13 |
Correct |
4 ms |
2680 KB |
ok, correct split |
14 |
Incorrect |
4 ms |
2680 KB |
invalid split: #1=1, #2=0, #3=4 |
15 |
Halted |
0 ms |
0 KB |
- |