|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|3 초||512 MB||9||3||3||42.857%|
The local council is recording traffic flow using a pressure pad laid across the road. The pressure pad tracks whenever the wheels on an axle of a vehicle cross the pressure pad. The only vehicles using the road are cars with two axles. Each vehicle may or may not have a single-axle trailer attached to it. When a car crosses the pressure pad, two times are recorded: one when the front wheels cross and another when the rear wheels cross. If the car is towing a trailer an additional time is recorded when the trailer wheels cross. Given a sequence of times from the recorder, the council wishes to know how many cars without trailers crossed the pad and how many cars with trailers crossed it.
Obviously, there is some ambiguity. For example, a sequence of 6 recordings could be three cars without trailers or two cars with trailers. To reduce such ambiguity, we will make the following two assumptions:
Given a sequence of times, determine the number of cars with and without a trailer.
The first line of the input contains a single integer n (1 ≤ n ≤ 300 000), which is the number of times the pressure pad was triggered. The second line contains n distinct integers t1, . . . , tn (0 ≤ ti < 230) in increasing order, the times that the pressure pad was triggered. The times are in milliseconds.
Display the number of cars with and without trailers. If the number of cars of each type can be uniquely determined, then display two lines of the form
Cars without trailers: X Cars with trailers: Y
If there is no interpretation of the times that is consistent with the assumptions, then display Impossible.If there are multiple interpretations of the times that give different numbers of cars with and without trailers, then display Ambiguous.
7 10 200 5000 6100 7200 8300 9400
Cars without trailers: 2 Cars with trailers: 1
6 0 1100 2200 3300 4400 5500
4 0 1000 2000 3001