RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
R03619

S5. To-Do List

Unrated 레이팅 미적용
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Wow, your to-do list is empty...but not for long! Over the next few
seconds, you'll have to handle \(Q\)
updates to your to-do list.

For the first type of update, you will have to add a new homework
assignment to your to-do list. This assignment will be released at the
beginning of second \(s\), and will
take \(t\) seconds to complete \((1 \le s, t \le 10^6)\). For the second
type of update, you will have to remove the \(i\)-th homework assignment that was added
to your to-do list.

After each update, you wonder: what's the earliest time you can
finish all of the homework assignments in your to-do list? You can only
work on one assignment at a time, and you must finish a homework
assignment once you start it without switching to another
assignment.

제약

\((1 \le s, t \le 10^6)\)

입력 형식

The first line of input contains an integer \(Q\).

The next \(Q\) lines each contain a
line starting with a character A or D. A line
starting with A represents the first type of update and
ends with two space-separated encrypted* integers \(s'\) and \(t'\). A line starting with
D represents the second type of update and ends with an
encrypted integer \(i'\). It is
guaranteed that there have been at least \(i\) assignments added and that the \(i\)-th assignment to be added has not been
removed yet.

It is guaranteed that there is at least one homework assignment on
your to-do list after every update.

*Note that the input for this
problem is encrypted. To decrypt and obtain the actual values of \(s, t,\) and \(i\), you may use the following formulas:
$$ \begin{align*} s & = (s' + \text{ans}) \bmod (10^6+3)\\ t & = (t' + \text{ans}) \bmod (10^6+3)\\ i & = (i' + \text{ans}) \bmod (10^6+3) \end{align*} $$
Here, \(\text{ans}\) represents the answer after
the previous update and is initially \(0\) before any updates. It may also be
useful to note that mod corresponds to the % operator in
most programming languages, indicating the remainder after division. For
example, \(5\bmod 3 = 2\) and \(17\bmod 4 = 1\).

출력 형식

Output \(Q\) lines, where the \(i\)-th line contains the earliest time (in
seconds) you can finish all of the homework assignments in your to-do
list after the \(i\)-th update.

서브태스크
서브태스크점수설명

1

13점

\(1 \le Q \le 3 \, 000\) — None

2

40점

\(1 \le Q \le 10^6\) — Only updates of the first type

3

47점

\(1 \le Q \le 10^6\) — None

예제 1
입력
6
A 3 3
A 7 5
A 4 3
D 1
A 8 2
D 2
출력
5
11
13
11
13
9
설명

The unencrypted sample input is provided for ease of reference.

After the first update, we can start the first assignment at the
beginning of second \(3\) and finish at
the end of second \(5\) (interval \([3, 5]\)).

After the second update, we can do the first assignment over the
interval \([3, 5]\) and the second
assignment over the interval \([7, 11]\).

After the third update, we can do the first assignment over the
interval \([3, 5]\), the third
assignment over the interval \([6, 8]\), and then the second assignment over the interval \([9, 13]\).

After the fourth update, we can do the third assignment over the
interval \([4, 6]\) and the second
assignment over the interval \([7, 11]\).

After the fifth update, we can do the third assignment over the
interval \([4, 6]\), the second
assignment over the interval \([7, 11]\), and the fourth assignment over the interval \([12, 13]\).

After the sixth update, we can do the third assignment over the
interval \([4, 6]\) and the fourth
assignment over the interval \([8, 9]\).

예제 2
입력
2
A 1000000 1000000
A 1000000 1000000
출력
1999999
2999999
문제 정보

생성자가 기록되지 않았습니다.

출처 CCC 2025 Senior

평가 및 의견

S5. To-Do List

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

S5. To-Do List

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8