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"Let's say Pak Chanek has an array A consisting of N positive integers. Pak Chanek will do a number of operations. In each operation, Pak Chanek will do the following: After each operation, all elements of A must be positive integers. An array A is said to be sortable if and only if Pak Chanek can do zero or more operations so that A_1 < A_2 < A_3 < A_4 < ldots < A_N . Pak Chanek must find an array A that is sortable with length N such that A_1 + A_2 + A_3 + A_4 + ldots + A_N is the minimum possible. If there are more than one possibilities, Pak Chanek must choose the array that is lexicographically minimum among them. Pak Chanek must solve the following things: Help Pak Chanek solve the problem. Note: an array B of size N is said to be lexicographically smaller than an array C that is also of size N if and only if there exists an index i such that B_i < C_i and for each j < i , B_j = C_j . The first line contains two integers N and Q ( 1 <= q N <= q 10^9 , 0 <= q Q <= q min(N, 10^5) ) -- the required length of array A and the number of questions. The i -th of the next Q lines contains a single integer P_i ( 1 <= q P_1 < P_2 < ldots < P_Q <= q N ) -- the index asked in the i -th question. Print Q+1 lines. The 1 -st line contains an integer representing A_1 + A_2 + A_3 + A_4 + ldots + A_N . For each 1 <= q i <= q Q , the (i+1) -th line contains an integer representing A_{P_i} . In the first example, the array A obtained is [1, 2, 3, 3, 4, 4] . We can see that the array is sortable by doing the following operations: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
170881406 |
kaiboy rainboy Dukkha |
D |
Sept. 4, 2022, 6:05 p.m. |
OK |
GNU C11 |
TESTS |
28 |
436 |
819200 |
|
|
170861627 |
gisp_zjz triple__a Roundgod |
D |
Sept. 4, 2022, 3:04 p.m. |
OK |
GNU C++14 |
TESTS |
28 |
62 |
5017600 |
|
|
170901750 |
faustaadp |
D |
Sept. 5, 2022, 12:59 a.m. |
OK |
GNU C++17 |
TESTS |
28 |
62 |
1433600 |
|
|
170909802 |
faustaadp |
D |
Sept. 5, 2022, 4:37 a.m. |
OK |
GNU C++17 |
TESTS |
28 |
78 |
1433600 |
|
|
170880110 |
yyljkydr Suika_predator oipotato |
D |
Sept. 4, 2022, 5:50 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
140 |
4198400 |
|
|
170897735 |
Wailydest |
D |
Sept. 4, 2022, 10:43 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
234 |
6758400 |
|
|
170875859 |
SSRS_ riantkb tatyam |
D |
Sept. 4, 2022, 5:03 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
249 |
5222400 |
|
|
170907921 |
Kinon |
D |
Sept. 5, 2022, 3:51 a.m. |
OK |
GNU C++17 |
TESTS |
28 |
467 |
5222400 |
|
|
170880554 |
potato167 |
D |
Sept. 4, 2022, 5:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
61 |
4096000 |
|
|
170884731 |
clam |
D |
Sept. 4, 2022, 6:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
249 |
14438400 |
|
|
170899720 |
HappyPacMan |
D |
Sept. 4, 2022, 11:49 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
46 |
1638400 |
|
|
170871790 |
HollwoQ_Pelw khuepr123 thenymphsofdelphi |
D |
Sept. 4, 2022, 4:26 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
46 |
4812800 |
|
|
170878288 |
ksun48 |
D |
Sept. 4, 2022, 5:29 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
78 |
2355200 |
|
|
170878170 |
ksun48 |
D |
Sept. 4, 2022, 5:28 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
93 |
2355200 |
|
|
170876806 |
fenzhang hiwang123 spentplaying |
D |
Sept. 4, 2022, 5:13 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
202 |
2867200 |
|
|
170871656 |
jiangly |
D |
Sept. 4, 2022, 4:25 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
327 |
819200 |
|
|
170870615 |
Mr_Eight wangziji Qingyu |
D |
Sept. 4, 2022, 4:16 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
421 |
1638400 |
|
|
170884646 |
Maksim1744 |
D |
Sept. 4, 2022, 6:40 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
717 |
7372800 |
|
|
170870454 |
Batrr mhq 353cerega |
D |
Sept. 4, 2022, 4:15 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
732 |
3174400 |
|
|
170882653 |
fastmath turmax LeoPro |
D |
Sept. 4, 2022, 6:19 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
1638 |
4300800 |
|
|
remove filters
Back to search problems