Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'You have an array a_1, a_2, ... , a_n consisting of n distinct integers. You are allowed to perform the following operation on it: Note that the array changes after each operation, and the subsequent operations are performed on the new array. What is the maximum number of times you can perform the operation on the array? The first line consists of a single integer n ( 2 <= n <= 10^6 ). The second line consists of n integers a_1, a_2, ... , a_n ( 1 <= q a_i <= q 10^6 ). All a_i are distinct. Output a single line containing one integer -- the maximum number of times the operation can be performed on the given array. In the first example, one of the ways to perform maximum number of operations on the array is: It can be proved that there is no way to perform more than 3 operations on the original array. In the second example one can add 3 , then 1 , then 5 , and 2 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
142875969 |
Gassa |
D |
Jan. 15, 2022, 4:26 p.m. |
OK |
D |
TESTS |
42 |
202 |
29491200 |
|
|
142893301 |
ruban |
D |
Jan. 15, 2022, 6:54 p.m. |
OK |
Delphi |
TESTS |
44 |
358 |
10956800 |
|
|
142877888 |
gaoqian |
D |
Jan. 15, 2022, 4:30 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
171 |
5017600 |
|
|
142874556 |
cylx |
D |
Jan. 15, 2022, 4:22 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
187 |
1024000 |
|
|
142880110 |
mystar |
D |
Jan. 15, 2022, 4:34 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
187 |
4096000 |
|
|
142886649 |
tokitsukaze |
D |
Jan. 15, 2022, 5:34 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
202 |
8089600 |
|
|
142894615 |
zettt |
D |
Jan. 15, 2022, 7:16 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
218 |
102400 |
|
|
142911378 |
980798778 |
D |
Jan. 16, 2022, 4:13 a.m. |
OK |
GNU C++14 |
TESTS |
45 |
218 |
5017600 |
|
|
142907286 |
Luminolic_Black |
D |
Jan. 16, 2022, 2:27 a.m. |
OK |
GNU C++14 |
TESTS |
44 |
218 |
5017600 |
|
|
142909735 |
xudong |
D |
Jan. 16, 2022, 3:34 a.m. |
OK |
GNU C++14 |
TESTS |
44 |
218 |
9011200 |
|
|
142895666 |
AlexRex0 |
D |
Jan. 15, 2022, 7:35 p.m. |
OK |
GNU C++14 |
TESTS |
44 |
233 |
1024000 |
|
|
142914574 |
342zhuyongqi |
D |
Jan. 16, 2022, 5:17 a.m. |
OK |
GNU C++14 |
TESTS |
45 |
233 |
3993600 |
|
|
remove filters
Back to search problems