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

Sladoled

설명

In the ice cream city, \(n\) ice cream stands have opened, but at the opening, none
of the stands had any ice cream scoops for sale.
In the next \(q\) days, shipments of ice cream scoops will arrive at some stands. On
each of the \(q\) days, two integers \(a\) and \(b\) are given, meaning that stand \(a\) received
a shipment of ice cream scoops of flavor \(b\) on that day.
At each stand, it is also possible to make ice cream combinations. A combination
can use the scoops that are available at that stand, where each scoop can be
used an arbitrary number of times, and a combination consists of at least 1 ice
cream scoop.
The value of a combination is equal to the sum of the flavors of the scoops in that combination, and flavors
can repeat. We are interested in combinations whose value is less than or equal to 50000 (combinations
with higher values are too sweet).
After each day, it is necessary to print how many different values of ice cream combinations can be made
at the stand that received ice cream scoops on that day.

제약

Subtask 1 (16 points): \(n = 1\), \(q \le 20\)

Subtask 2 (33 points): \(q \le 100\)

Subtask 5 (61 points): No additional constraints.

입력 형식

The first line contains the natural numbers \(n\) and \(q\) (\(1 \le n \le 100\), \(1 \le q \le 10^{5}\)), as described in the
problem statement.
Each of the next \(q\) lines contains two numbers \(a\) and \(b\) (\(1 \le a \le n\), \(1 \le b \le 50000\)), as described in the
problem statement.

출력 형식

Print \(q\) lines with the answers to the queries described in the problem statement.

예제 1
입력
1 2
1 3
1 5
출력
16666
49996
예제 2
입력
2 4
2 35625
1 25139
1 37795
2 17791
출력
1
1
2
3
설명

Explanation of the first sample test: After the first day, the values of ice cream combinations at
the first stand that can be made are all multiples of 3 less than or equal to 50000. There are 16666 such
combinations. After the second day, the only combination values that cannot be made are: 1, 2, 4, 7. All
other combination values can be made, totaling 49996.

문제 정보

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

출처 COCI 2025/2026 Contest 4

평가 및 의견

Sladoled

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

Log in to rate problems.

개별 의견

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

풀이 제출

Sladoled

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