Input file: | Standard input | Time limit: | 1 sec | |
Output file: | Standard output | Memory limit: | 256 Mb |
Young historian Vasya, as part of his dissertation work, is engaged in comparing records from documents stored in the archive.
Each document covers a specific time interval and contains information about events that occurred during that time.
Vasya is interested in how the same event was covered in different sources.
To achieve this, he has to search for documents each time that could contain a record of the event he is interested in.
As there could be too many such events, you are required to write a program that, for a given event, would perform a search for all relevant documents.
At the beginning of the input data there is a natural number N, followed by 2 × N integers specifying the time interval [Ai, Bi] for each document.
Then, there is a number M and exactly M queries containing the time of the event Cj.
The output data should contain a set of answers to each of these queries.
It starts with the number of detected documents, followed by their numbers.
It is assumed that the numbering of documents starts from zero.
Constraints: The total number of documents in the output does not exceed 106.
− 106 ≤ Ai ≤ Bi ≤ 106, − 106 ≤ Cj ≤ 106, 1 ≤ N ≤ 2 ⋅ 104, 1 ≤ M ≤ 105
No. | Standard input | Standard output |
---|---|---|
1 |
|
|