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'The only difference between this problem and the easy version is the constraints on t and n . You are given an array a , consisting of n distinct integers a_1, a_2, ldots, a_n . Define the beauty of an array p_1, p_2, ldots p_k as the minimum amount of time needed to sort this array using an arbitrary number of range-sort operations. In each range-sort operation, you will do the following: Please calculate the sum of beauty over all subarrays of array a . A subarray of an array is defined as a sequence of consecutive elements of the array. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 3 cdot 10^5 ) -- the length of the array a . The second line of each test case consists of n integers a_1,a_2, ldots, a_n ( 1 <= a_i <= 10^9 ). It is guaranteed that all elements of a are pairwise distinct. It is guaranteed that the sum of n over all test cases does not exceed 3 cdot 10^5 . For each test case, output the sum of beauty over all subarrays of array a . In the first test case: In the second test case: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
205923227 |
rainboy |
B2 |
May 14, 2023, 9 p.m. |
OK |
GNU C11 |
TESTS |
46 |
109 |
9011200 |
|
2400 |
206163098 |
marcoolmap |
B2 |
May 17, 2023, 1:08 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
109 |
12595200 |
|
2400 |
206190069 |
luogu_bot1 |
B2 |
May 17, 2023, 9:16 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
124 |
12185600 |
|
2400 |
206215394 |
luogu_bot4 |
B2 |
May 17, 2023, 1:19 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
124 |
12595200 |
|
2400 |
205869383 |
cyh_toby |
B2 |
May 14, 2023, 3:06 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
124 |
14438400 |
|
2400 |
206449482 |
intmain111 |
B2 |
May 19, 2023, 1:08 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
124 |
18432000 |
|
2400 |
206036255 |
hhoppitree |
B2 |
May 16, 2023, 12:30 a.m. |
OK |
GNU C++14 |
TESTS |
46 |
124 |
22220800 |
|
2400 |
206401040 |
FredericM |
B2 |
May 19, 2023, 3:52 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
124 |
45670400 |
|
2400 |
205883081 |
Xtale_cross |
B2 |
May 14, 2023, 3:35 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
139 |
30412800 |
|
2400 |
205904276 |
Edlue |
B2 |
May 14, 2023, 5:16 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
140 |
29184000 |
|
2400 |
205871402 |
al3xstr33t |
B2 |
May 14, 2023, 3:09 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
140 |
30105600 |
|
2400 |
205903936 |
chen_zexing |
B2 |
May 14, 2023, 5:13 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
93 |
6041600 |
|
2400 |
205880506 |
chen_zexing |
B2 |
May 14, 2023, 3:28 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
108 |
6041600 |
|
2400 |
205939978 |
simiao1986 |
B2 |
May 15, 2023, 4:25 a.m. |
OK |
GNU C++17 |
TESTS |
46 |
109 |
10854400 |
|
2400 |
205905278 |
OIer_kzc |
B2 |
May 14, 2023, 5:27 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
109 |
28876800 |
|
2400 |
206131052 |
ventusliberum |
B2 |
May 16, 2023, 4:01 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
124 |
11366400 |
|
2400 |
205991231 |
warner1129 |
B2 |
May 15, 2023, 1:39 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
124 |
15974400 |
|
2400 |
206205470 |
taintedsilk |
B2 |
May 17, 2023, 11:51 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
124 |
19968000 |
|
2400 |
205897872 |
sangonomiya_kokomi |
B2 |
May 14, 2023, 4:22 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
124 |
22528000 |
|
2400 |
205966883 |
Deep_Kevin |
B2 |
May 15, 2023, 10:15 a.m. |
OK |
GNU C++17 |
TESTS |
46 |
124 |
24064000 |
|
2400 |
206016472 |
HaPpY1213 |
B2 |
May 15, 2023, 5:52 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
124 |
29593600 |
|
2400 |
206189700 |
yangjl |
B2 |
May 17, 2023, 9:12 a.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
78 |
6246400 |
|
2400 |
205891828 |
HCPS42 |
B2 |
May 14, 2023, 4:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
78 |
9113600 |
|
2400 |
205868249 |
kotatsugame |
B2 |
May 14, 2023, 3:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
93 |
13209600 |
|
2400 |
205870659 |
tute7627 |
B2 |
May 14, 2023, 3:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
93 |
13926400 |
|
2400 |
206042791 |
Alex_Wei |
B2 |
May 16, 2023, 3:35 a.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
93 |
15974400 |
|
2400 |
205972579 |
Alex_Wei |
B2 |
May 15, 2023, 11:18 a.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
93 |
15974400 |
|
2400 |
206314109 |
zlxFTH |
B2 |
May 18, 2023, 8:28 a.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
93 |
15974400 |
|
2400 |
206409758 |
udon1206 |
B2 |
May 19, 2023, 6:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
93 |
16384000 |
|
2400 |
206209764 |
2100031015cse |
B2 |
May 17, 2023, 12:29 p.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
93 |
20172800 |
|
2400 |
205991290 |
alif_cse_ju |
B2 |
May 15, 2023, 1:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
93 |
30720000 |
|
2400 |
206192359 |
1eave |
B2 |
May 17, 2023, 9:39 a.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
62 |
6348800 |
|
2400 |
206214989 |
2018LZY |
B2 |
May 17, 2023, 1:16 p.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
62 |
12800000 |
|
2400 |
206060329 |
harshbutani01 |
B2 |
May 16, 2023, 8:01 a.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
62 |
12800000 |
|
2400 |
206205536 |
taintedsilk |
B2 |
May 17, 2023, 11:51 a.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
62 |
20172800 |
|
2400 |
206295212 |
amoeba1 |
B2 |
May 18, 2023, 4:07 a.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
62 |
21196800 |
|
2400 |
205879272 |
emorgan5289 |
B2 |
May 14, 2023, 3:25 p.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
78 |
9113600 |
|
2400 |
206067300 |
fallleaves01 |
B2 |
May 16, 2023, 9:21 a.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
78 |
15564800 |
|
2400 |
205935729 |
arodnap33 |
B2 |
May 15, 2023, 3:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
93 |
8396800 |
|
2400 |
205950861 |
noya2 |
B2 |
May 15, 2023, 7:11 a.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
93 |
10854400 |
|
2400 |
205876542 |
maspy |
B2 |
May 14, 2023, 3:19 p.m. |
OK |
GNU C++20 (64) |
TESTS |
46 |
93 |
12492800 |
|
2400 |
205884986 |
knightL |
B2 |
May 14, 2023, 3:40 p.m. |
OK |
Java 11 |
TESTS |
46 |
794 |
41369600 |
|
2400 |
205881917 |
insert_cool_handle |
B2 |
May 14, 2023, 3:32 p.m. |
OK |
Java 11 |
TESTS |
46 |
826 |
39628800 |
|
2400 |
205929562 |
kamranm |
B2 |
May 15, 2023, 12:04 a.m. |
OK |
Java 17 |
TESTS |
46 |
811 |
213196800 |
|
2400 |
205873686 |
FastFreeTask |
B2 |
May 14, 2023, 3:14 p.m. |
OK |
Kotlin 1.6 |
TESTS |
46 |
514 |
35737600 |
|
2400 |
205939970 |
neerajam |
B2 |
May 15, 2023, 4:25 a.m. |
OK |
PyPy 3 |
TESTS |
46 |
561 |
33894400 |
|
2400 |
205998649 |
bronze_coder |
B2 |
May 15, 2023, 2:48 p.m. |
OK |
PyPy 3-64 |
TESTS |
46 |
218 |
56217600 |
|
2400 |
206014201 |
00zijian |
B2 |
May 15, 2023, 5:27 p.m. |
OK |
PyPy 3-64 |
TESTS |
46 |
233 |
48742400 |
|
2400 |
206192170 |
1eave |
B2 |
May 17, 2023, 9:37 a.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
248 |
48844800 |
|
2400 |
206013381 |
00zijian |
B2 |
May 15, 2023, 5:18 p.m. |
OK |
PyPy 3-64 |
TESTS |
46 |
248 |
48844800 |
|
2400 |
206013446 |
00zijian |
B2 |
May 15, 2023, 5:18 p.m. |
OK |
PyPy 3-64 |
TESTS |
46 |
265 |
60825600 |
|
2400 |
206319779 |
2000030958 |
B2 |
May 18, 2023, 9:24 a.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
373 |
43724800 |
|
2400 |
205904347 |
minhnguyen13082003 |
B2 |
May 14, 2023, 5:17 p.m. |
OK |
PyPy 3-64 |
TESTS |
46 |
404 |
52940800 |
|
2400 |
206013336 |
00zijian |
B2 |
May 15, 2023, 5:17 p.m. |
OK |
PyPy 3-64 |
TESTS |
46 |
436 |
60825600 |
|
2400 |
206281790 |
titia |
B2 |
May 17, 2023, 9:19 p.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
561 |
74752000 |
|
2400 |
206296505 |
lunw1024 |
B2 |
May 18, 2023, 4:35 a.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
904 |
94924800 |
|
2400 |
206303617 |
Hidden-Ninja |
B2 |
May 18, 2023, 6:26 a.m. |
OK |
Python 3 |
TESTS |
47 |
592 |
46694400 |
|
2400 |
206059982 |
ilyshana |
B2 |
May 16, 2023, 7:56 a.m. |
OK |
Rust 2021 |
TESTS |
47 |
46 |
30720000 |
|
2400 |
206035555 |
Spheniscine |
B2 |
May 16, 2023, 12:03 a.m. |
OK |
Rust 2021 |
TESTS |
46 |
108 |
9728000 |
|
2400 |
205906243 |
cpchenpi |
B2 |
May 14, 2023, 5:38 p.m. |
OK |
Rust 2021 |
TESTS |
46 |
358 |
99020800 |
|
2400 |
205905978 |
RustIsBestLang |
B2 |
May 14, 2023, 5:35 p.m. |
OK |
Rust 2021 |
TESTS |
46 |
358 |
99020800 |
|
2400 |
remove filters
Back to search problems