시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
5 초 | 512 MB | 99 | 79 | 76 | 80.851% |
There exist some cities that are built along a straight road. The cities are numbered 1, 2, 3... from left to right.
There are N GBuses that operate along this road. For each GBus, we know the range of cities that it serves: the i-th gBus serves the cities with numbers between Ai and Bi, inclusive.
We are interested in a particular subset of P cities. For each of those cities, we need to find out how many GBuses serve that particular city.
The first line of the input gives the number of test cases, T. Then, T test cases follow; each case is separated from the next by one blank line. (Notice that this is unusual for Kickstart data sets.)
In each test case:
For each test case, output one line containing Case #x: y
, where x
is the number of the test case (starting from 1), and y
is a list of P integers, in which the i-th integer is the number of GBuses that serve city Ci.
2 4 15 25 30 35 45 50 10 20 2 15 25 10 10 15 5 12 40 55 1 10 25 35 45 50 20 28 27 35 15 40 4 5 3 5 10 27
Case #1: 2 1 Case #2: 3 3 4
In Sample Case #1, there are four GBuses. The first serves cities 15 through 25, the second serves cities 30 through 35, the third serves cities 45 through 50, and the fourth serves cities 10 through 20. City 15 is served by the first and fourth buses, so the first number in our answer list is 2. City 25 is served by only the first bus, so the second number in our answer list is 1.
Contest > Google > Google's Coding Competitions > Google APAC 2015 University Graduates Test > Round D APAC Test B2번
Contest > Google > Kick Start > Google Kick Start 2014 > Round D B2번