1074: Just another pachinko-like machine
Memory Limit:128 MB
Time Limit:2.000 S
Judge Style:Text Compare
Creator:
Submit:2
Solved:0
Description
不允许普通用户打印题目,请教师登录后使用。如有疑问请联系管理员!
Input
There will be at most 5 test cases. Each test case begins with one integer n (1<=n<=105), the number of bars. Each of the next lines contains 5 integers x1, y1, x2, y2, s, d (0<=x1<x2<=109, 1<=y1,y2<=200000, 1<=s<=1000, 1<=d<=5), describing one bar. No two bars can have any common point (i.e. no intersection, can’t touch each other etc).
The next line contains b (1<=b<=105), the number of balls. In the next b lines, the i-th line describes the ball appear in the i-th step. Each line contains two integers (x', y'), that means the ball will appear at (xi,yi)=(x' XOR a, y' XOR a), where a is the current score before the ball falls (which will be zero at the beginning of each test case). It is guaranteed that xi and yi are non-negative integers and will not be precisely on a bar.
The next line contains b (1<=b<=105), the number of balls. In the next b lines, the i-th line describes the ball appear in the i-th step. Each line contains two integers (x', y'), that means the ball will appear at (xi,yi)=(x' XOR a, y' XOR a), where a is the current score before the ball falls (which will be zero at the beginning of each test case). It is guaranteed that xi and yi are non-negative integers and will not be precisely on a bar.
Output
For each test case, print the case number in the first line and the scores after each step. There should be one empty line after each test case.
Sample Input Copy
2
0 4 4 4 1 4
2 2 6 2 9 1
5
3 5
2 4
11 15
9 9
16 26
3
0 6 10 7 1 5
2 4 8 3 10 5
4 2 6 2 100 5
4
5 7
4 6
14 12
106 104
Sample Output Copy
Case 1:
1
10
10
19
20
Case 2:
1
11
111
111
HINT
Explanation for Sample 1
Step 1:
ball (3,5) will hit the first bar, score=1
Step 2:
ball (3,5) will hit the second bar, score=9
Step 3(bar 2 appear again):
ball (1,5) will hit the ground, score=0
Step 4:
ball (3,3) will hit the second bar, score=9
Step 5(bar 1&2 appear again):
ball (3,9) will hit the first bar again, score=1
Step 1:
ball (3,5) will hit the first bar, score=1
Step 2:
ball (3,5) will hit the second bar, score=9
Step 3(bar 2 appear again):
ball (1,5) will hit the ground, score=0
Step 4:
ball (3,3) will hit the second bar, score=9
Step 5(bar 1&2 appear again):
ball (3,9) will hit the first bar again, score=1