CF164E.Polycarpus and Tasks

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

Then nn lines describe the tasks. The ii -th line contains three space-separated integers lil_{i} , rir_{i} , tit_{i} ( 1<=li<=ri<=1091<=l_{i}<=r_{i}<=10^{9} , 1<=ti<=rili+11<=t_{i}<=r_{i}-l_{i}+1 ) — the description of the ii -th task.

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

输入格式

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

  • 0 — if you managed to add task ii on step 4.
  • -1 — if you didn't manage to add or replace task ii (step 7).
  • resires_{i} ( 1<=resi<=n1<=res_{i}<=n ) — if you managed to replace the task (step 6): resires_{i} equals the task number (in set AA ), that should be chosen as bkb_{k} and replaced by task aia_{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 
首页