Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 150 点
問題文
AtCoder社のオフィスには加湿器が 1 つあります。現在は時刻 0 であり、加湿器には水が入っていません。
あなたはこの加湿器にこれから N 回水を追加します。i 回目 (1\leq i \leq N)の水の追加は時刻 T_i に行い、水を V_i リットル追加します。なお、 T_i < T_{i+1} (1 \leq i \leq N-1) を満たすことが保証されます。
ただし、加湿器には穴が空いていて、加湿器に水が入っている間は 1 単位時間につき水が 1 リットル減り続けます。
時刻 T_N に水を追加し終えたとき、加湿器に残っている水の量を求めてください。
制約
- 1 \leq N \leq 100
- 1 \leq T_i \leq 100 (1 \leq i \leq N)
- 1 \leq V_i \leq 100 (1 \leq i \leq N)
- T_i < T_{i+1} (1 \leq i \leq N-1)
- 入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
N T_1 V_1 T_2 V_2 \vdots T_N V_N
出力
答えを出力せよ。
入力例 1
4 1 3 3 1 4 4 7 1
出力例 1
3
時系列で以下のように水が追加されます。
- 時刻 1 : 水を追加する前は 0 リットル入っており、3 リットル追加して加湿器には 3 リットルの水が入っています。
- 時刻 3 : 水を追加する前は 1 リットル入っており、1 リットル追加して加湿器には 2 リットルの水が入っています。
- 時刻 4 : 水を追加する前は 1 リットル入っており、4 リットル追加して加湿器には 5 リットルの水が入っています。
- 時刻 7 : 水を追加する前は 2 リットル入っており、1 リットル追加して加湿器には 3 リットルの水が入っています。
時刻 7 に水を追加し終えたとき、加湿器に残っている水の量は 3 リットルです。よって答えは 3 です。
入力例 2
3 1 8 10 11 21 5
出力例 2
5
入力例 3
10 2 1 22 10 26 17 29 2 45 20 47 32 72 12 75 1 81 31 97 7
出力例 3
57
Score : 150 points
Problem Statement
There is one humidifier in the AtCoder company office. The current time is 0, and the humidifier has no water inside.
You will add water to this humidifier N times. The i-th addition of water (1 \leq i \leq N) takes place at time T_i, and you add V_i liters of water. It is guaranteed that T_i < T_{i+1} for all 1 \leq i \leq N-1.
However, the humidifier has a leak, and as long as there is water inside, the amount of water decreases by 1 liter per unit time.
Find the amount of water remaining in the humidifier immediately after you finish adding water at time T_N.
Constraints
- 1 \leq N \leq 100
- 1 \leq T_i \leq 100 (1 \leq i \leq N)
- 1 \leq V_i \leq 100 (1 \leq i \leq N)
- T_i < T_{i+1} (1 \leq i \leq N-1)
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N T_1 V_1 T_2 V_2 \vdots T_N V_N
Output
Print the answer.
Sample Input 1
4 1 3 3 1 4 4 7 1
Sample Output 1
3
At each point in time, water is added as follows:
- Time 1: Before adding, the humidifier has 0 liters. After adding 3 liters, it has 3 liters.
- Time 3: Before adding, it has 1 liter. After adding 1 liter, it has 2 liters total.
- Time 4: Before adding, it has 1 liter. After adding 4 liters, it has 5 liters total.
- Time 7: Before adding, it has 2 liters. After adding 1 liter, it has 3 liters total.
After finishing the addition at time 7, the humidifier contains 3 liters. Thus, the answer is 3.
Sample Input 2
3 1 8 10 11 21 5
Sample Output 2
5
Sample Input 3
10 2 1 22 10 26 17 29 2 45 20 47 32 72 12 75 1 81 31 97 7
Sample Output 3
57
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 250 点
問題文
AtCoder社のオフィスは H 行 W 列のマス目で表されます。上から i 行目、左から j 列目のマスを (i, j) と表します。
各マスの状態は文字 S_{i,j} で表され、 S_{i,j} が #
のときそのマスは机、.
のときそのマスは床です。床のマスは 2 つ以上存在することが保証されます。
あなたは床のマスから異なる 2 マスを選び、加湿器を設置します。
加湿器が設置されたとき、あるマス (i,j) は加湿器があるマス (i',j') からのマンハッタン距離が D 以下であるとき、またその時に限り加湿されます。 なお、マス (i,j) からマス (i',j') までのマンハッタン距離は |i-i'|+|j-j'| で表されます。 ここで、加湿器が置かれた床のマスは必ず加湿されていることに注意してください。
加湿される 床のマス の個数として考えられる最大値を求めてください。
制約
- 1 \leq H \leq 10
- 1 \leq W \leq 10
- 2 \leq H \times W
- 0 \leq D \leq H+W-2
- H,W,D は整数
- S_{i,j} は
#
または.
である (1 \leq i \leq H, 1 \leq j \leq W) - 床のマスは 2 つ以上存在する
入力
入力は以下の形式で標準入力から与えられる。
H W D S_{1,1}S_{1,2}\cdotsS_{1,W} S_{2,1}S_{2,2}\cdotsS_{2,W} \vdots S_{H,1}S_{H,2}\cdotsS_{H,W}
出力
答えを出力せよ。
入力例 1
2 5 1 .###. .#.##
出力例 1
3
マス (1,1) とマス (1,5) に加湿器を置いた時:
- マス (1,1) の加湿器によってマス (1,1),(2,1) の 2 マスが加湿されます。
- マス (1,5) の加湿器によってマス (1,5) の 1 マスが加湿されます。
よって、合計 3 マス加湿されています。また、4 マス以上加湿するような加湿器の置き方は存在しないため、答えは 3 です。
入力例 2
5 5 2 .#.#. ..... .#.#. #.#.# .....
出力例 2
15
マス (2,4) とマス (5,3) に加湿器を置いた時、15 個の床のマスが加湿されます。
入力例 3
4 4 2 .... .##. .##. ....
出力例 3
10
Score : 250 points
Problem Statement
The AtCoder company office can be represented as a grid of H rows and W columns. Let (i, j) denote the cell at the i-th row from the top and j-th column from the left.
The state of each cell is represented by a character S_{i,j}. If S_{i,j} is #
, that cell contains a desk; if S_{i,j} is .
, that cell is a floor. It is guaranteed that there are at least two floor cells.
You will choose two distinct floor cells and place a humidifier on each.
After placing the humidifiers, a cell (i,j) is humidified if and only if it is within a Manhattan distance D from at least one of the humidifier cells (i',j'). The Manhattan distance between (i,j) and (i',j') is defined as |i - i'| + |j - j'|. Note that any floor cell on which a humidifier is placed is always humidified.
Find the maximum possible number of humidified floor cells.
Constraints
- 1 \leq H \leq 10
- 1 \leq W \leq 10
- 2 \leq H \times W
- 0 \leq D \leq H+W-2
- H,W,D are integers.
- S_{i,j} is
#
or.
. (1 \leq i \leq H, 1 \leq j \leq W) - There are at least two floor cells.
Input
The input is given from Standard Input in the following format:
H W D S_{1,1}S_{1,2}\cdotsS_{1,W} S_{2,1}S_{2,2}\cdotsS_{2,W} \vdots S_{H,1}S_{H,2}\cdotsS_{H,W}
Output
Print the answer.
Sample Input 1
2 5 1 .###. .#.##
Sample Output 1
3
When placing humidifiers on (1,1) and (1,5):
- From the humidifier on (1,1), two cells (1,1) and (2,1) are humidified.
- From the humidifier on (1,5), one cell (1,5) is humidified.
In total, three cells are humidified. No configuration can humidify four or more floor cells, so the answer is 3.
Sample Input 2
5 5 2 .#.#. ..... .#.#. #.#.# .....
Sample Output 2
15
When placing humidifiers on (2,4) and (5,3), 15 floor cells are humidified.
Sample Input 3
4 4 2 .... .##. .##. ....
Sample Output 3
10
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 350 点
問題文
AtCoder社のオフィスは H 行 W 列のマス目で表されます。上から i 行目、左から j 列目のマスを (i, j) と表します。
各マスの状態は文字 S_{i,j} で表され、 S_{i,j} が #
のときそのマスは壁、.
のときそのマスは床、H
のときそのマスは加湿器が置かれた床です。
あるマスは、ある加湿器から壁を通らず上下左右に D 回以下の移動で辿り着ける場合加湿されます。ここで、加湿器が置かれた床のマスは必ず加湿されていることに注意してください。
加湿されている床のマスの個数を求めてください。
制約
- 1 \leq H \leq 1000
- 1 \leq W \leq 1000
- 0 \leq D \leq H\times W
- S_{i,j} は
#
または.
またはH
である (1 \leq i \leq H, 1 \leq j \leq W) - 入力される数値は全て整数
入力
入力は以下の形式で標準入力から与えられる。
H W D S_{1,1}S_{1,2}\cdotsS_{1,W} S_{2,1}S_{2,2}\cdotsS_{2,W} \vdots S_{H,1}S_{H,2}\cdotsS_{H,W}
出力
答えを出力せよ。
入力例 1
3 4 1 H... #..H .#.#
出力例 1
5
マス (1,1),(1,2),(1,4),(2,3),(2,4) の 5 つのマスが加湿されています。
入力例 2
5 6 2 ##...H H..... ..H.#. .HH... .###..
出力例 2
21
入力例 3
1 6 3 ...#..
出力例 3
0
加湿されるマスが存在しない場合もあります。
Score : 350 points
Problem Statement
The AtCoder company office is represented as a grid of H rows and W columns. Let (i, j) denote the cell at the i-th row from the top and j-th column from the left.
The state of each cell is represented by a character S_{i,j}. If S_{i,j} is #
, that cell has a wall; if S_{i,j} is .
, that cell is a floor; if S_{i,j} is H
, that cell has a humidifier placed on a floor cell.
A certain cell is considered humidified if it can be reached from at least one humidifier cell by at most D moves up, down, left, or right without passing through a wall. Note that any cell with a humidifier is always humidified.
Find the number of humidified floor cells.
Constraints
- 1 \leq H \leq 1000
- 1 \leq W \leq 1000
- 0 \leq D \leq H\times W
- S_{i,j} is
#
,.
, orH
. (1 \leq i \leq H, 1 \leq j \leq W) - All input numbers are integers.
Input
The input is given from Standard Input in the following format:
H W D S_{1,1}S_{1,2}\cdotsS_{1,W} S_{2,1}S_{2,2}\cdotsS_{2,W} \vdots S_{H,1}S_{H,2}\cdotsS_{H,W}
Output
Print the answer.
Sample Input 1
3 4 1 H... #..H .#.#
Sample Output 1
5
Five cells (1,1), (1,2), (1,4), (2,3), (2,4) are humidified.
Sample Input 2
5 6 2 ##...H H..... ..H.#. .HH... .###..
Sample Output 2
21
Sample Input 3
1 6 3 ...#..
Sample Output 3
0
It is possible that no cells are humidified.
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 400 点
問題文
N 以下の正整数のうち、正の約数をちょうど 9 個持つものの個数を求めてください。
制約
- 1\leq N\leq 4\times 10^{12}
- 入力される数値は全て整数
入力
入力は以下の形式で標準入力から与えられる。
N
出力
答えを出力せよ。
入力例 1
200
出力例 1
3
条件を満たす正整数は 36,100,196 の 3 個です。
入力例 2
4000000000000
出力例 2
407073
Score : 400 points
Problem Statement
Find the number of positive integers not greater than N that have exactly 9 positive divisors.
Constraints
- 1 \leq N \leq 4 \times 10^{12}
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N
Output
Print the answer.
Sample Input 1
200
Sample Output 1
3
Three positive integers 36,100,196 satisfy the condition.
Sample Input 2
4000000000000
Sample Output 2
407073
Time Limit: 2.5 sec / Memory Limit: 1024 MiB
配点 : 500 点
問題文
頂点に 1 から N の番号が、辺に 1 から M の番号が付いた N 頂点 M 辺の重み付き単純連結無向グラフが与えられます。辺 i (1 \leq i \leq M) は頂点 u_i と頂点 v_i を双方向に結び、重みは w_i です。
あるパスに対してその重みをそのパスに含まれる辺の重みの最大値とします。 また、f(x,y) を 頂点 x から頂点 y へのパスの重みとしてありえる最小値とします。
長さ K の数列 (A_1,A_2,\ldots,A_K) と (B_1,B_2,\ldots,B_K) が与えられます。ここで、A_i \neq B_j (1 \leq i,j \leq K) が成り立つことが保証されます。
数列 B を自由に並べ替えて、\displaystyle\sum_{i=1}^{K}f(A_i,B_i) を最小化してください。
制約
- 2 \leq N \leq 2 \times 10^5
- N-1 \leq M \leq \min(\frac{N \times (N-1)}{2},2 \times 10^5)
- 1 \leq K \leq N
- 1 \leq u_i<v_i \leq N (1 \leq i \leq M)
- 1 \leq w_i \leq 10^9
- 1 \leq A_i,B_i \leq N (1 \leq i \leq K)
- A_i \neq B_j (1 \leq i,j \leq K)
- 与えられるグラフは単純かつ連結
- 入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
N M K u_1 v_1 w_1 u_2 v_2 w_2 \vdots u_M v_M w_M A_1 A_2 \ldots A_K B_1 B_2 \ldots B_K
出力
\displaystyle\sum_{i=1}^{K}f(A_i,B_i) の最小値を出力せよ。
入力例 1
4 4 3 1 3 2 3 4 1 2 4 5 1 4 4 1 1 3 4 4 2
出力例 1
8
B を並び替えて、B=(2,4,4) としたとき、
- f(1,2)=5 : 頂点 1 から頂点 4 を経由し頂点 2 に行くパスがあり、辺 3 の重み 5 が最大値を取ります。また、辺の重みの最大値が 4 以下になるようなパスは存在しないため 5 が最小値です。
- f(1,4)=2 : 頂点 1 から頂点 3 を経由し頂点 4 に行くパスがあり、辺 1 の重み 2 が最大値を取ります。また、辺の重みの最大値が 1 以下になるようなパスは存在しないため 2 が最小値です。
- f(3,4)=1 : 頂点 3 から頂点 4 への辺を通るパスがあり、辺の重みは 1 でこれが辺の重みの最大値です。また、パスの重みが 0 以下になることはないため 1 が最小値です。
よって、この場合 \displaystyle \sum_{i=1}^{3}f(A_i,B_i)=5+2+1=8 となります。また、B をどのように並び替えても 7 以下になることはないため、答えは 8 です。
入力例 2
3 3 2 1 2 5 2 3 2 1 3 1 1 1 2 3
出力例 2
3
Score : 500 points
Problem Statement
You are given a simple connected undirected graph with N vertices and M edges, where vertices are numbered 1 to N and edges are numbered 1 to M. Edge i (1 \leq i \leq M) connects vertices u_i and v_i bidirectionally and has weight w_i.
For a path, define its weight as the maximum weight of an edge in the path. Define f(x, y) as the minimum possible path weight of a path from vertex x to vertex y.
You are given two sequences of length K: (A_1, A_2, \ldots, A_K) and (B_1, B_2, \ldots, B_K). It is guaranteed that A_i \neq B_j (1 \leq i,j \leq K).
Permute the sequence B freely so that \displaystyle \sum_{i=1}^{K} f(A_i, B_i) is minimized.
Constraints
- 2 \leq N \leq 2 \times 10^5
- N-1 \leq M \leq \min(\frac{N \times (N-1)}{2},2 \times 10^5)
- 1 \leq K \leq N
- 1 \leq u_i<v_i \leq N (1 \leq i \leq M)
- 1 \leq w_i \leq 10^9
- 1 \leq A_i,B_i \leq N (1 \leq i \leq K)
- The given graph is simple and connected.
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N M K u_1 v_1 w_1 u_2 v_2 w_2 \vdots u_M v_M w_M A_1 A_2 \ldots A_K B_1 B_2 \ldots B_K
Output
Print the minimum value of \displaystyle \sum_{i=1}^{K} f(A_i, B_i).
Sample Input 1
4 4 3 1 3 2 3 4 1 2 4 5 1 4 4 1 1 3 4 4 2
Sample Output 1
8
If we rearrange B as (2,4,4):
- f(1,2) = 5: The path from vertex 1 to vertex 2 passing through vertex 4 contains edge 3 with a maximum edge weight of 5. There is no path with a maximum edge weight less than or equal to 4, so 5 is the minimum possible.
- f(1,4) = 2: The path from vertex 1 to vertex 4 passing through vertex 3 contains edge 1 with a maximum edge weight of 2. There is no path with a maximum edge weight less than or equal to 1, so 2 is the minimum possible.
- f(3,4) = 1: The path from vertex 3 to vertex 4 passing through the direct edge contains an edge with a maximum edge weight of 1. No path can have a maximum weight 0 or less, so 1 is the minimum possible.
Thus, \displaystyle \sum_{i=1}^{3} f(A_i, B_i) = 5+2+1=8. No permutation of B yields 7 or less, so the answer is 8.
Sample Input 2
3 3 2 1 2 5 2 3 2 1 3 1 1 1 2 3
Sample Output 2
3
Time Limit: 2.5 sec / Memory Limit: 1024 MiB
配点 : 525 点
問題文
店で N 個の商品が売られています。 i 個目の商品の価格は P_i 円、効用は U_i 、色は C_i です。
あなたは、これらの N 個の商品から何個か( 0 個でもよい)を選んで購入します。 このとき、購入した品物の合計価格は X 円以下でなければなりません。
あなたの満足度は、購入した商品の効用の合計を S、購入した商品の色の種類数を T としたとき、S+T \times K です。 ここで、K は入力で与えられる定数です。
あなたの満足度を最大化するように購入する商品を選んだとき、満足度を求めてください。
制約
- 1 \leq N \leq 500
- 1 \leq X \leq 50000
- 1 \leq K \leq 10^9
- 1 \leq P_i \leq X (1 \leq i \leq N)
- 1 \leq U_i \leq 10^9 (1 \leq i \leq N)
- 1 \leq C_i \leq N (1 \leq i \leq N)
- 入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
N X K P_1 U_1 C_1 P_2 U_2 C_2 \vdots P_N U_N C_N
出力
答えを出力せよ。
入力例 1
3 10 5 1 3 1 7 4 2 4 5 1
出力例 1
17
1 個目、2 個目の商品を購入したとき、効用の合計 S は 7 で、色の種類数 T は 2 です。よって、満足度は 7+2 \times 5 = 17 です。また、満足度が 18 以上になるような購入の仕方は存在しないため、答えは 17 です。
入力例 2
5 30 3 5 4 3 11 20 1 9 10 4 7 5 2 16 15 4
出力例 2
44
2 個目、3 個目、4 個目の商品を購入したとき、効用の合計 S は 35 で、色の種類数 T は 3 です。よって、満足度は 35+3 \times 3 = 44 です。また、満足度が 45 以上になるような購入の仕方は存在しないため、答えは 44 です。
入力例 3
22 75 6426 9 309 9 5 470 5 17 481 12 27 352 14 1 191 18 7 353 20 9 99 15 20 401 17 46 434 19 11 459 22 10 317 19 15 440 18 17 438 19 25 461 22 5 320 22 1 476 21 11 315 3 8 112 9 11 438 13 19 362 8 10 422 13 10 152 21
出力例 3
67717
Score : 525 points
Problem Statement
There are N products for sale in a store. The i-th product has a price of P_i yen, a utility value of U_i, and a color C_i.
You will choose some subset of these N products to buy (possibly none). The total price of the chosen products must be at most X yen.
Your satisfaction is S + T \times K, where S is the sum of utilities of the chosen products, and T is the number of distinct colors among the chosen products. Here, K is a given constant.
You will choose products to maximize your satisfaction. Find the maximized satisfaction.
Constraints
- 1 \leq N \leq 500
- 1 \leq X \leq 50000
- 1 \leq K \leq 10^9
- 1 \leq P_i \leq X (1 \leq i \leq N)
- 1 \leq U_i \leq 10^9 (1 \leq i \leq N)
- 1 \leq C_i \leq N (1 \leq i \leq N)
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N X K P_1 U_1 C_1 P_2 U_2 C_2 \vdots P_N U_N C_N
Output
Print the answer.
Sample Input 1
3 10 5 1 3 1 7 4 2 4 5 1
Sample Output 1
17
If you buy the 1st and 2nd products, the total utility S is 7, and the number of distinct colors T is 2. Thus, your satisfaction is 7 + 2 \times 5 = 17. No purchase plan makes your satisfaction 18 or greater, so the answer is 17.
Sample Input 2
5 30 3 5 4 3 11 20 1 9 10 4 7 5 2 16 15 4
Sample Output 2
44
If you buy the 2nd, 3rd, and 4th products, the total utility S is 35, and the number of distinct colors T is 3. Thus, your satisfaction is 35 + 3 \times 3 = 44. No purchase plan makes your satisfaction 45 or greater, so the answer is 44.
Sample Input 3
22 75 6426 9 309 9 5 470 5 17 481 12 27 352 14 1 191 18 7 353 20 9 99 15 20 401 17 46 434 19 11 459 22 10 317 19 15 440 18 17 438 19 25 461 22 5 320 22 1 476 21 11 315 3 8 112 9 11 438 13 19 362 8 10 422 13 10 152 21
Sample Output 3
67717
Time Limit: 3 sec / Memory Limit: 1024 MiB
配点 : 625 点
問題文
N 個のマスが横一列に並んでいて、左から i 番目のマスには整数 A_i が書かれています。
また、あなたは連続するマス K 個を覆えるタイルを \lfloor \frac{N}{K}\rfloor 枚持っています。
i=1,\ldots,\lfloor \frac{N}{K}\rfloor について以下の問題を解いてください。
- タイルを重ならずにちょうど i 個置くとき、タイルで覆われたマスに書かれた数の和としてありうる値の最大値を求めよ。
制約
- 1\leq N\leq 2\times 10^5
- 1\leq K \leq \min(5,N)
- -10^9\leq A_i\leq 10^9
- 入力される数値は全て整数
入力
入力は以下の形式で標準入力から与えられる。
N K A_1 \ldots A_N
出力
i=1,\ldots,\lfloor \frac{N}{K}\rfloor に対する問題の答えを空白区切りで一行に出力せよ。
入力例 1
6 2 -5 3 4 -1 6 -2
出力例 1
7 12 5
i=1 の場合、左から 2 番目のマスと 3 番目のマスをタイル 1 枚で覆うと、覆われたマスに書かれた数の和は 7 となります。
i=2 の場合、左から 2 番目のマスと 3 番目のマスをタイル 1 枚で覆い、左から 4 番目のマスと 5 番目のマスをタイル 1 枚で覆うと、覆われたマスに書かれた数の和は 12 となります。
入力例 2
20 4 -5 3 4 -1 6 -2 13 -1 13 7 6 -12 3 -5 12 -6 -3 10 -15 -5
出力例 2
32 45 57 52 22
Score : 625 points
Problem Statement
You have a row of N cells. The i-th cell from the left contains an integer A_i.
You also have \lfloor \frac{N}{K} \rfloor tiles, each of which covers K consecutive cells.
For each i = 1, \ldots, \lfloor \frac{N}{K} \rfloor, solve the following problem:
- When placing exactly i tiles without overlap, find the maximum possible sum of the numbers in the covered cells.
Constraints
- 1 \leq N \leq 2 \times 10^5
- 1 \leq K \leq \min(5,N)
- -10^9 \leq A_i \leq 10^9
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N K A_1 \ldots A_N
Output
Print the answers for i = 1, \ldots, \lfloor \frac{N}{K} \rfloor separated by spaces in one line.
Sample Input 1
6 2 -5 3 4 -1 6 -2
Sample Output 1
7 12 5
For i=1, if you cover the 2nd and 3rd cells with one tile, the sum of the numbers in the covered cells is 7.
For i=2, if you cover the 2nd and 3rd cells with one tile and the 4th and 5th cells with another tile, the sum of the numbers in the covered cells is 12.
Sample Input 2
20 4 -5 3 4 -1 6 -2 13 -1 13 7 6 -12 3 -5 12 -6 -3 10 -15 -5
Sample Output 2
32 45 57 52 22