問題一覧 > 通常問題

No.3678 The Man Who Talked Too Much

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 155
作問者 : ゆにたりー卿 / テスター : drken1215 👑 loop0919 Mikan04y lp_ql yimiya(いみや) よには elphe Andrew8128 edon8618 👑 seekworser leaf_1415 紫前燈太 triangle_coder 👑 みうね
お気に入りにしたユーザー ProblemId : 13085 / 自分の提出
問題文最終更新日: 2026-09-04 22:47:47
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
第3回 岩井星人アンソロジープログラミングコンテスト (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。