A8383 | Polycarpus and Tasks
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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}$ .
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}$ .
- 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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted