Testcase:
1
9
9
1 2
2 3
3 1
4 5
5 6
4 6
7 8
7 9
8 9
What is expected output?
I ran on an accepted code and got this:
3
1 1 1 1 1 1 1 2 3
I feel answer should be :
3
2 3 1 2 3 1 2 3 1
Please Help??
Testcase:
1
9
9
1 2
2 3
3 1
4 5
5 6
4 6
7 8
7 9
8 9
What is expected output?
I ran on an accepted code and got this:
3
1 1 1 1 1 1 1 2 3
I feel answer should be :
3
2 3 1 2 3 1 2 3 1
Please Help??
For each test case, print two lines. The first of these lines should contain a single integer ― the minimum K. The second line should contain N space-separated integers, where for each valid ii, the ii-th integer denotes the subgraph that vertex ii belongs to.
If there are multiple solutions, you may output any one.
your algorithm may be considering each disconnected component as a graph, and it’s fine it produces
3
2 3 1 2 3 1 2 3 1
accepted one considers whole graph as one
yep!
You need to divide the vertices into subgraphs in such a way that the number of edges connecting between them is even.
If the output satisfies that then it’s a valid solution
(i literally explained the whole question again but it was stated very clearly in what @aryanc403 wrote)