测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A8383. Polycarpus and Tasks

编程题 普及/提高-

题目描述

The first line of the input contains a single integer $n$ ( $1<=n<=10^{5}$ ) — the number of tasks in set $A$ .

Then $n$ lines describe the tasks. The $i$ -th line contains three space-separated integers $l_{i}$ , $r_{i}$ , $t_{i}$ ( $1<=l_{i}<=r_{i}<=10^{9}$ , $1<=t_{i}<=r_{i}-l_{i}+1$ ) — the description of the $i$ -th task.

It is guaranteed that for any tasks $j,k$ (considering that $j<k$ ) the following is true: $l_{j}<l_{k}$ and $r_{j}<r_{k}$ .

输入格式

For each task $i$ print a single integer — the result of processing task $i$ on the $i$ -th iteration of the cycle (step 3) in function $f(A)$ . In the $i$ -th line print:

- 0 — if you managed to add task $i$ on step 4.
- -1 — if you didn't manage to add or replace task $i$ (step 7).
- $res_{i}$ ( $1<=res_{i}<=n$ ) — if you managed to replace the task (step 6): $res_{i}$ equals the task number (in set $A$ ), that should be chosen as $b_{k}$ and replaced by task $a_{i}$ .

输出格式

无

输入输出样例

输入 #1
5
1 8 5
2 9 3
3 10 3
8 11 4
11 12 2
输出 #1
0 0 1 0 -1 
输入 #2
13
1 8 5
2 9 4
3 10 1
4 11 3
8 12 5
9 13 5
10 14 5
11 15 1
12 16 1
13 17 1
14 18 3
15 19 3
16 20 2
输出 #2
0 0 0 2 -1 -1 0 0 0 0 7 0 12 
上一题 去做题 下一题