#SRD0000053. Điệu nhảy của những chú voi (Dancing Elephants)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Điệu nhảy của những chú voi (Dancing Elephants)
Dancing Elephants
Source: IOI
Version: Phuoc Hung OJ Extended
Problem Statement
There are elephants on a number line, with fixed elephant IDs from to and initially sorted positions . A camera covers elephants in any closed interval of length at most . After each move, find the minimum number of cameras needed to photograph all elephants.
An operation i y moves the elephant with fixed ID to coordinate . Elephants may change their order and can occupy equal coordinates. Cameras may be repositioned after every move.
This adaptation converts the IOI init/update grader interface to standard input/output: one answer line for each update. No hidden expected-answer field s[j] is supplied in the input.
Input
The first line contains . The next lines specify the initially nondecreasing elephant positions . Each of the final lines contains i y, where elephant ID (zero-indexed) moves to position . All positions and lie in .
Output
After every move, output the minimum number of cameras on a separate line.
Subtasks
- Subtask 1 (10 points): ; ; Exactly two elephants; all current positions remain distinct.
- Subtask 2 (16 points): ; ; All current elephant positions remain pairwise distinct after every move.
- Subtask 3 (24 points): ; ; All current elephant positions remain pairwise distinct after every move.
- Subtask 4 (47 points): ; ; Multiple elephants may share the same position.
- Subtask 5 (3 points): ; ; No additional restriction; coincident positions are allowed.
Examples
Input
4 10 5
10
15
17
20
2 16
1 25
3 35
0 38
2 0
Output
1
2
2
2
3
Explanation
Initially all four positions fit in a length- interval. Moving elephant ID 2 to still needs one camera; moving ID 1 to needs two. The remaining three updates yield 2, 2, and 3 cameras respectively.