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.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
---|---|---|---|---|---|---|
1117 | Educational Codeforces Round 60 (Rated for Div. 2) | FINISHED | False | 7200 | 181318799 | Feb. 18, 2019, 3:40 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 701 ) | G | Recursive Queries | PROGRAMMING | data structures | 2500 |
B"You are given a permutation p_1, p_2, ... , p_n . You should answer q queries. Each query is a pair (l_i, r_i) , and you should calculate f(l_i, r_i) . Let's denote m_{l, r} as the position of the maximum in subsegment p_l, p_{l+1}, ... , p_r . Then f(l, r) = (r - l + 1) + f(l, m_{l,r} - 1) + f(m_{l,r} + 1, r) if l <= r or 0 otherwise. The first line contains two integers n and q ( 1 <= n <= 10^6 , 1 <= q <= 10^6 ) -- the size of the permutation p and the number of queries. The second line contains n pairwise distinct integers p_1, p_2, ... , p_n ( 1 <= p_i <= n , p_i neq p_j for i neq j ) -- permutation p . The third line contains q integers l_1, l_2, ... , l_q -- the first parts of the queries. The fourth line contains q integers r_1, r_2, ... , r_q -- the second parts of the queries. It's guaranteed that 1 <= l_i <= r_i <= n for all queries. Print q integers -- the values f(l_i, r_i) for the corresponding queries. Description of the queries: "... |
65365 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
53385870 | wucstdio | G | April 27, 2019, 3:27 a.m. | OK | GNU C++11 | TESTS | 33 | 920 | 180224000 | 2500 | |
50266544 | vjudge4 | G | Feb. 21, 2019, 4:45 a.m. | OK | GNU C++11 | TESTS | 33 | 1029 | 208486400 | 2500 | |
50144000 | CzxingcHen | G | Feb. 19, 2019, 1:52 a.m. | OK | GNU C++11 | TESTS | 33 | 1044 | 52019200 | 2500 | |
50130140 | iSooke | G | Feb. 18, 2019, 5:33 p.m. | OK | GNU C++11 | TESTS | 33 | 1045 | 208486400 | 2500 | |
50162405 | YangDavid | G | Feb. 19, 2019, 1:10 p.m. | OK | GNU C++11 | TESTS | 33 | 1107 | 89600000 | 2500 | |
50162310 | YangDavid | G | Feb. 19, 2019, 1:08 p.m. | OK | GNU C++11 | TESTS | 33 | 1138 | 89702400 | 2500 | |
52462491 | LJC00118 | G | April 7, 2019, 2:01 p.m. | OK | GNU C++11 | TESTS | 33 | 1200 | 77107200 | 2500 | |
50682466 | fzszchy2001 | G | March 2, 2019, 12:07 p.m. | OK | GNU C++11 | TESTS | 33 | 1216 | 96256000 | 2500 | |
50485583 | maxtir | G | Feb. 25, 2019, 11:22 a.m. | OK | GNU C++11 | TESTS | 33 | 1232 | 93184000 | 2500 | |
50340509 | pseudo | G | Feb. 23, 2019, 1:41 a.m. | OK | GNU C++11 | TESTS | 33 | 1247 | 82124800 | 2500 | |
50591810 | interestingLSY | G | Feb. 28, 2019, 7:53 a.m. | OK | GNU C++14 | TESTS | 33 | 966 | 72089600 | 2500 | |
50591718 | interestingLSY | G | Feb. 28, 2019, 7:51 a.m. | OK | GNU C++14 | TESTS | 33 | 1013 | 72089600 | 2500 | |
50628116 | HatsuneMikuo | G | March 1, 2019, 7:25 a.m. | OK | GNU C++14 | TESTS | 33 | 1045 | 72089600 | 2500 | |
50595973 | Mlxa | G | Feb. 28, 2019, 10:14 a.m. | OK | GNU C++14 | TESTS | 33 | 1325 | 146432000 | 2500 | |
50328784 | hohomu | G | Feb. 22, 2019, 5:41 p.m. | OK | GNU C++14 | TESTS | 33 | 1513 | 85811200 | 2500 | |
50123975 | dreamoon_love_AA | G | Feb. 18, 2019, 4:58 p.m. | OK | GNU C++14 | TESTS | 33 | 1559 | 91136000 | 2500 | |
50128625 | natsugiri | G | Feb. 18, 2019, 5:25 p.m. | OK | GNU C++14 | TESTS | 33 | 1591 | 63692800 | 2500 | |
50282808 | Origenes | G | Feb. 21, 2019, 1:29 p.m. | OK | GNU C++14 | TESTS | 33 | 1715 | 96665600 | 2500 | |
50129719 | kdh9949 | G | Feb. 18, 2019, 5:31 p.m. | OK | GNU C++14 | TESTS | 33 | 1731 | 157286400 | 2500 | |
58095676 | schtomi97 | G | July 31, 2019, 7:40 p.m. | OK | GNU C++14 | TESTS | 33 | 1778 | 51609600 | 2500 | |
50428511 | CMXRYNP | G | Feb. 24, 2019, 12:48 p.m. | OK | GNU C++17 | TESTS | 33 | 826 | 102195200 | 2500 | |
50400258 | neal | G | Feb. 23, 2019, 5:53 p.m. | OK | GNU C++17 | TESTS | 33 | 950 | 102502400 | 2500 | |
50400543 | neal | G | Feb. 23, 2019, 6:02 p.m. | OK | GNU C++17 | TESTS | 33 | 950 | 106496000 | 2500 | |
50591856 | interestingLSY | G | Feb. 28, 2019, 7:55 a.m. | OK | GNU C++17 | TESTS | 33 | 1107 | 72089600 | 2500 | |
60947961 | hjj | G | Sept. 20, 2019, 7:54 p.m. | OK | GNU C++17 | TESTS | 33 | 1403 | 172339200 | 2500 | |
60054781 | dafeng | G | Sept. 5, 2019, 3:21 a.m. | OK | GNU C++17 | TESTS | 33 | 1465 | 76697600 | 2500 | |
54580414 | Anachor | G | May 25, 2019, 4:18 a.m. | OK | GNU C++17 | TESTS | 33 | 1497 | 97075200 | 2500 | |
51168324 | codgician | G | March 11, 2019, 3:14 p.m. | OK | GNU C++17 | TESTS | 33 | 1606 | 59187200 | 2500 | |
50419619 | yum | G | Feb. 24, 2019, 8:22 a.m. | OK | GNU C++17 | TESTS | 33 | 1637 | 61030400 | 2500 | |
50400058 | neal | G | Feb. 23, 2019, 5:48 p.m. | OK | GNU C++17 | TESTS | 33 | 1637 | 102400000 | 2500 | |
67484866 | Dukkha | G | Dec. 23, 2019, 5:07 p.m. | OK | Java 11 | TESTS | 33 | 3213 | 117555200 | 2500 | |
50122228 | niyaznigmatul | G | Feb. 18, 2019, 4:48 p.m. | OK | Java 8 | TESTS | 33 | 3213 | 249139200 | 2500 | |
50121962 | niyaznigmatul | G | Feb. 18, 2019, 4:47 p.m. | OK | Java 8 | TESTS | 33 | 3790 | 258969600 | 2500 | |
50152156 | r57shell | G | Feb. 19, 2019, 8 a.m. | OK | MS C++ | TESTS | 33 | 1855 | 64716800 | 2500 | |
50591894 | interestingLSY | G | Feb. 28, 2019, 7:56 a.m. | OK | MS C++ 2017 | TESTS | 33 | 1169 | 74956800 | 2500 |
Back to search problems