No.3678 The Man Who Talked Too Much
タグ : / 解いたユーザー数 155
作問者 :
ゆにたりー卿
/ テスター :
drken1215
👑
lp_ql
yimiya(いみや)
よには
Andrew8128
leaf_1415
triangle_coder
👑 Problem Statement
Iwai Seijin posts live commentary videos on YouTube showing how he participates in competitive programming contests.
Before a contest, Iwai Seijin gives an opening talk to the viewers of his videos, but sometimes he keeps talking without starting on the problems even after the contest has begun.
Iwai Seijin is about to participate in IWAtCoder Beginner Contest 003 (IWABC003), a competitive programming contest.
The duration of IWABC003 is ${6000}$ seconds, and ${7}$ problems are given.
The ${i\ (1 \leq i \leq 7)}$-th problem is called Problem ${i}$.
As soon as IWABC003 begins, Iwai Seijin chats for ${0}$ or more seconds, and after that, until IWABC003 ends, he solves Problems ${1,\ 2,\ \cdots,\ 7}$ in this order.
Once Iwai Seijin starts solving a problem, he does not start solving the next problem unless he has finished solving that problem.
Also, the time between finishing chatting and starting to solve Problem ${1}$, and the time between finishing a problem and starting to solve the next problem, are both ${0}$ seconds.
The time from when Iwai Seijin starts solving Problem ${i\ (1 \leq i \leq 7)}$ until he finishes solving it is ${T_i}$ seconds.
However, if ${T_i = -1}$, then once Iwai Seijin starts solving Problem ${i}$, he keeps solving it until the end of the contest.
For each ${i\ (1 \leq i \leq 7)}$, we say that Iwai Seijin gets ${i}$ solves if he finishes solving all of Problems ${1,\ 2,\ \dots,\ i}$ during IWABC003.
Find the maximum number of seconds Iwai Seijin can chat if he wants to get ${i}$ solves.
However, if Iwai Seijin cannot get ${i}$ solves, output ${-1}$.
Constraints
- All inputs are integers
- ${1 \leq T_i \leq 6000}$ or ${T_i = -1\ (1 \leq i \leq 7)}$
Input
The input is given from standard input in the following format.
${T_1\ T_2\ \dots\ T_7}$
Output
Output ${7}$ lines.
On the ${i\ (1 \leq i \leq 7)}$-th line, output the maximum number of seconds Iwai Seijin can chat if he wants to get ${i}$ solves. However, if Iwai Seijin cannot get ${i}$ solves, output ${-1}$.
Sample
Sample 1
Input
204 507 241 694 2293 -1 -1
Output
5796 5289 5048 4354 2061 -1 -1
For example, if Iwai Seijin chats for ${5289}$ seconds, it takes ${204}$ seconds from starting Problem ${1}$ until finishing it and ${507}$ seconds from starting Problem ${2}$ until finishing it, for a total of ${5289 + 204 + 507 = 6000}$ seconds. Since this equals the contest duration, Iwai Seijin can get ${2}$ solves, and we can see that if he chats any longer, he cannot get ${2}$ solves.
Thus, if Iwai Seijin wants to get ${2}$ solves, he can chat for at most ${5289}$ seconds, so output ${5289}$ on line ${2}$.
Also, Iwai Seijin cannot get ${6}$ solves, so output ${-1}$ on line ${6}$.
Sample 2
Input
118 378 -1 -1 -1 -1 -1
Output
5882 5504 -1 -1 -1 -1 -1
Sometimes it turns out like "I'll totally get 2 solves".
Sample 3
Input
1000 1000 1000 1000 1000 1000 1000
Output
5000 4000 3000 2000 1000 0 -1
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。