농부 존의 소 \(N\)마리 \((1 \leq N \leq 5 \cdot 10^5)\)가 원형으로 서 있다. \(i\)번째 소는 정수 용량 \(a_i\) \((1 \leq a_i \leq 10^9)\)리터의 양동이를 가지고 있다. 처음에 모든 양동이는 가득 차 있다.
매 분마다 \(1\le i
\(1, 2, \dots, N\)분이 각각 지난 후, 모든 소에게 남아 있는 우유의 총량은 얼마인가?
출제: Chongtian Ma, Alex Liang, Patrick Deng
배점
- 입력 4-5: \(N \le 2000\)
- 입력 6-8: \(a_i \le 2\)
- 입력 9-13: 모든 \(a_i\)가 \([1,10^9]\) 범위에서 균등한 확률로 무작위로 생성된다.
- 입력 14-23: 추가 제약 없음.
출제: Chongtian Ma, Alex Liang, Patrick Deng
첫째 줄에 \(N\)이 주어진다.
다음 줄에 정수 \(a_1,a_2,...,a_N\)이 주어진다.
\(N\)개의 줄을 출력한다. \(i\)번째 줄에는 \(i\)분 후 모든 소에게 남아 있는 우유의 총량을 출력한다.
6
2 2 2 1 2 18
7
6
6
6
6Initially, the amount of milk in each bucket is \([2, 2, 2, 1, 2, 1]\).
- After \(1\) minute, the amount of milk in each bucket is \([1, 2, 2, 1, 1, 1]\) so the total amount of milk is \(8\).
- After \(2\) minutes, the amount of milk in each bucket is \([1, 1, 2, 1, 1, 1]\) so the total amount of milk is \(7\).
- After \(3\) minutes, the amount of milk in each bucket is \([1, 1, 1, 1, 1, 1]\) so the total amount of milk is \(6\).
- After \(4\) minutes, the amount of milk in each bucket is \([1, 1, 1, 1, 1, 1]\) so the total amount of milk is \(6\).
- After \(5\) minutes, the amount of milk in each bucket is \([1, 1, 1, 1, 1, 1]\) so the total amount of milk is \(6\).
- After \(6\) minutes, the amount of milk in each bucket is \([1, 1, 1, 1, 1, 1]\) so the total amount of milk is \(6\).
8
3 8 6 4 8 3 8 125
20
17
14
12
10
8
8After \(1\) minute, the amount of milk in each bucket is
\([1, 3, 6, 4, 4, 3, 3, 1]\) so the total amount of milk is \(25\).
10
9 9 10 10 6 8 2 1000000000 1000000000 10000000002000000053
1000000054
56
49
42
35
28
24
20
20riseoj 작성
출처 올림피아드 > USACO > 2023-2024 > February > Gold