A10685 | Travel Card
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
A new innovative ticketing systems for public transport is introduced in Bytesburg. Now there is a single travel card for all transport. To make a trip a passenger scan his card and then he is charged according to the fare.
The fare is constructed in the following manner. There are three types of tickets:
1. a ticket for one trip costs $20$ byteland rubles,
2. a ticket for $90$ minutes costs $50$ byteland rubles,
3. a ticket for one day ( $1440$ minutes) costs $120$ byteland rubles.
Note that a ticket for $x$ minutes activated at time $t$ can be used for trips started in time range from $t$ to $t+x-1$ , inclusive. Assume that all trips take exactly one minute.
To simplify the choice for the passenger, the system automatically chooses the optimal tickets. After each trip starts, the system analyses all the previous trips and the current trip and chooses a set of tickets for these trips with a minimum total cost. Let the minimum total cost of tickets to cover all trips from the first to the current is $a$ , and the total sum charged before is $b$ . Then the system charges the passenger the sum $a-b$ .
You have to write a program that, for given trips made by a passenger, calculates the sum the passenger is charged after each trip.
The fare is constructed in the following manner. There are three types of tickets:
1. a ticket for one trip costs $20$ byteland rubles,
2. a ticket for $90$ minutes costs $50$ byteland rubles,
3. a ticket for one day ( $1440$ minutes) costs $120$ byteland rubles.
Note that a ticket for $x$ minutes activated at time $t$ can be used for trips started in time range from $t$ to $t+x-1$ , inclusive. Assume that all trips take exactly one minute.
To simplify the choice for the passenger, the system automatically chooses the optimal tickets. After each trip starts, the system analyses all the previous trips and the current trip and chooses a set of tickets for these trips with a minimum total cost. Let the minimum total cost of tickets to cover all trips from the first to the current is $a$ , and the total sum charged before is $b$ . Then the system charges the passenger the sum $a-b$ .
You have to write a program that, for given trips made by a passenger, calculates the sum the passenger is charged after each trip.
输入格式
The first line of input contains integer number $n$ ( $1<=n<=10^{5}$ ) — the number of trips made by passenger.
Each of the following $n$ lines contains the time of trip $t_{i}$ ( $0<=t_{i}<=10^{9}$ ), measured in minutes from the time of starting the system. All $t_{i}$ are different, given in ascending order, i. e. $t_{i+1}>t_{i}$ holds for all $1<=i<n$ .
Each of the following $n$ lines contains the time of trip $t_{i}$ ( $0<=t_{i}<=10^{9}$ ), measured in minutes from the time of starting the system. All $t_{i}$ are different, given in ascending order, i. e. $t_{i+1}>t_{i}$ holds for all $1<=i<n$ .
输出格式
Output $n$ integers. For each trip, print the sum the passenger is charged after it.
输入输出样例
输入 #1
3 10 20 30
输出 #1
20 20 10
输入 #2
10 13 45 46 60 103 115 126 150 256 516
输出 #2
20 20 10 0 20 0 0 20 20 10
In the first example, the system works as follows: for the first and second trips it is cheaper to pay for two one-trip tickets, so each time $20$ rubles is charged, after the third trip the system understands that it would be cheaper to buy a ticket for $90$ minutes. This ticket costs $50$ rubles, and the passenger had already paid $40$ rubles, so it is necessary to charge $10$ rubles only.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted