Some hints

Posted by

monsky 30 Oct 2016 18:39

Online tests surely contain several tests in one file, so:

1. Be sure clean your dictionaries before every test.

2. Be sure read ALL lines of current test, even you got correct answer before all input was used.

This two issues were the reason of my WA1. After fixing them I got "Accepted".

Use the following test to validate mentioned above points:

100

5

5 6 odd

7 8 odd

1 6 even

1 4 odd

7 8 even

3

3

1 1 odd

3 3 odd

1 3 odd

5

4

1 2 even

4 5 even

1 5 odd

3 3 even

10

5

1 2 even

3 4 odd

5 6 even

1 6 even

7 10 odd

20

8

1 9 odd

10 17 odd

18 26 odd

4 5 odd

27 40 even

21 40 odd

1 20 odd

10 20 odd

200

8

1 9 odd

10 17 odd

18 26 odd

4 5 odd

27 40 even

21 40 odd

1 20 odd

10 20 odd

-1

Answer:

4

3

3

3

2

6