ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

Tetrahedron Team Programming Contest May 2001

About     Problems     Submit solution     Judge status     Standings
Contest is over

F. Observers Coloring

Time limit: 0.5 second
Memory limit: 64 MB
Nikifor told us that once he solved problem at mathematical tournament of S.Petersburg's secondary school N239 in 1994. Nikifor said that he solved a problem from the moment T0 to the moment T1. He remembers that N observers appeared in the room. The i-th observer entered the room at the moment t0, i and went out at the moment t1, i. At every moment there was at least one observer in the room.
When the tournament was finished, Nikifor claimed that it is possible to color some observers, and the summary time when there was only one colored observer in the room is not less than 2/3 of the time when Nikifor solved problem.
You are to answer whether Nikifor right or not.

Input

The first line of input contains real numbers T0 and T1 (T0 < T1). The second line contains number N — number of observers (N < 10000). Next N lines contain real numbers t0, i and t1, i (T0t0, i < t1, iT1).

Output

If Nikifor is not right output should contain the only number 0. If Nikifor is right you should write to the first line the quantity of colored observers, and next lines should contain their numbers. Do not write more than one number in a line. You may write these numbers in any order. If there are more than one solution exist you may find any of them.

Sample

inputoutput
0.0 20.0
7
1.0 1.5
0.0 10.0
9.0 10.0
18.0 20.0
9.0 18.0
2.72 3.14
19.0 20.0
3
2
5
7
Problem Author: Dmitry Filimonenkov feat Igor Goldberg
Problem Source: Tetrahedron Team Contest May 2001
To submit the solution for this problem go to the Problem set: 1105. Observers Coloring