1160 - X-Plosives

All about problems in Volume 11. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

1160 - X-Plosives

Post by brianfry713 »

Input:

Code: Select all

1 2
3 4
3 5
3 1
2 3
4 1
2 6
6 5
-1

1 2
3 4
3 5
3 1
2 3
4 1
2 6
6 5
-1
AC output:

Code: Select all

3
3
Check input and AC output for thousands of problems on uDebug!
Repon kumar Roy
Learning poster
Posts: 96
Joined: Tue Apr 23, 2013 12:54 pm

Re: 1160 - X-Plosives

Post by Repon kumar Roy »

I am using Disjoint Set for this problem similar to MST kruskal algorithm .
Sample Input :

Code: Select all

4 9
1 3
5 9
4 10
1 6
3 4
8 4
8 10
1 3
-1

10 11
8 1
4 10
9 7
6 8
7 3
8 1
4 10
10 11
2 8
3 4
7 6
6 9
-1

5 8
2 4
9 5
9 1
5 7
1 4
3 7
10 5
2 4
8 9
9 4
9 2
6 4
-1

5 4
7 6
10 6
5 10
2 8
6 7
5 2
9 10
4 6
-1

3 7
7 8
9 5
2 8
-1

9 8
9 8
8 5
5 10
2 6
6 7
9 3
10 9
3 1
8 5
9 6
9 4
1 7
-1

3 6
3 4
8 2
6 3
2 3
1 2
9 8
7 1
1 10
6 7
3 9
6 10
5 4
10 1
-1

7 4
7 4
1 9
5 1
5 7
-1

7 5
4 9
5 1
1 10
4 8
6 8
3 10
8 6
7 6
4 1
-1

9 6
6 7
5 3
2 10
3 5
6 9
7 3
6 2
4 10
8 4
-1

6 1
3 2
9 8
2 6
6 9
-1

7 8
10 5
2 7
2 3
1 5
5 6
10 8
6 4
10 1
6 7
7 4
3 7
9 10
-1
Output :

Code: Select all

2
4
4
2
0
4
5
1
2
2
0
4
Post Reply

Return to “Volume 11 (1100-1199)”