F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Car

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 117    Accepted Submission(s): 5


Problem Description
HZ is driving a car along a straight road of length $L$. Now the car is at one end of the road, and HZ wants to go to the other end.

There are $N$ speed measuring points on the road. The distance between the start point and the $i$-th speed measuring point is $S_i$. The speed limit of the $i$-th speed measuring point is $V_i$, which means that when the car passes the point, its velocity should not exceed $V_i$.

The initial velocity of the car is zero, and the car must ${\bf stop}$ at the other end. The absolute value of acceleration of the car can not exceed $A$.

HZ wants you to calculate the shortest time to go to the other end of the road, but Zayin thinks it's too easy. Therefore, they come up with new problems for you.

Initially, there is no speed measuring point on the road. Then, the $N$ speed measuring points will be built one by one in order from $1$ to $N$. After each one is built, you need to answer whether the shortest time becomes longer or not.
 

Input
There are multiple test cases.

For each test case, the first line contains $3$ integers $L$, $A$ and $N$ $(1\leq L \leq 10^5,~ 1\leq A \leq 9,~ 1\leq N \leq 10^5)$.

In the next $n$ lines, each line contains $2$ integers $S_i$ and $V_i$ $(0\leq S_i \leq L,~ 1 \leq V_i \leq 10^3)$, denoting a speed measuring point. And they will be built in order of input.

It's guaranteed that the sum of $N$ of all the test cases is not larger than $2 \cdot 10^5$.
 

Output
For each test case, print $N$ lines.

In the $i$-th line of each test case, if the shortest time becomes longer after building the $i$-th one, print $1$. Otherwise, print $0$.
 

Sample Input
6 2 5 2 1 4 1 3 3 1 1 1 1
 

Sample Output
1 1 0 1 0
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-07-01 14:02:53, Gzip enabled