#include "split.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<long> >edges;
long x=1;
vector<int>ans;
vector<bool>vis;
long arr[3];
void solve(long n)
{
vis[n]=true;
if(arr[x]==0){
x++;
}
arr[x]--;
ans[n]=x+1;
for(long i=0;i<(long)edges[n].size();i++){
if(!vis[edges[n][i]]){
solve(edges[n][i]);
}
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
edges.resize(n);
ans.resize(n);
vis.resize(n);
for(long i=0;i<(long)p.size();i++){
edges[p[i]].push_back(q[i]);
edges[q[i]].push_back(p[i]);
}
arr[0]=a;
arr[1]=b;
arr[2]=c+a;
solve(0);
for(long i=0;i<n;i++){
if(ans[i]==3){
ans[i]=1;
break;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
ok, correct split |
2 |
Correct |
1 ms |
256 KB |
ok, correct split |
3 |
Correct |
1 ms |
256 KB |
ok, correct split |
4 |
Incorrect |
1 ms |
256 KB |
invalid split: #1=1, #2=1, #3=2 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
ok, correct split |
2 |
Correct |
1 ms |
256 KB |
ok, correct split |
3 |
Correct |
1 ms |
256 KB |
ok, correct split |
4 |
Correct |
136 ms |
12152 KB |
ok, correct split |
5 |
Correct |
90 ms |
8828 KB |
ok, correct split |
6 |
Correct |
93 ms |
12408 KB |
ok, correct split |
7 |
Correct |
92 ms |
11260 KB |
ok, correct split |
8 |
Correct |
157 ms |
14584 KB |
ok, correct split |
9 |
Correct |
92 ms |
9464 KB |
ok, correct split |
10 |
Correct |
58 ms |
9708 KB |
ok, correct split |
11 |
Correct |
60 ms |
9748 KB |
ok, correct split |
12 |
Correct |
62 ms |
10092 KB |
ok, correct split |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
invalid split: #1=1, #2=1, #3=3 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
invalid split: #1=1, #2=2, #3=6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
ok, correct split |
2 |
Correct |
1 ms |
256 KB |
ok, correct split |
3 |
Correct |
1 ms |
256 KB |
ok, correct split |
4 |
Incorrect |
1 ms |
256 KB |
invalid split: #1=1, #2=1, #3=2 |
5 |
Halted |
0 ms |
0 KB |
- |