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 |
---|---|---|---|---|---|---|
1736 | Codeforces Round 825 (Div. 2) | FINISHED | False | 7200 | 71767463 | Oct. 10, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1358 ) | C2 | Good Subarrays (Hard Version) | PROGRAMMING | binary search data structures two pointers |
B'This is the hard version of this problem. In this version, we have queries. Note that we do not have multiple test cases in this version. You can make hacks only if both versions of the problem are solved. An array b of length m is good if for all i the i -th element is greater than or equal to i . In other words, b is good if and only if b_i geq i for all i ( 1 <= q i <= q m ). You are given an array a consisting of n positive integers, and you are asked q queries. In each query, you are given two integers p and x ( 1 <= q p,x <= q n ). You have to do a_p := x (assign x to a_p ). In the updated array, find the number of pairs of indices (l, r) , where 1 <= l <= r <= n , such that the array [a_l, a_{l+1}, ldots, a_r] is good. Note that all queries are independent, which means after each query, the initial array a is restored. The first line contains a single integer n ( 1 <= n <= 2 cdot 10^5 ). The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= n ). The third line contains an integer q ( 1 <= q q <= q 2 cdot 10^5 ) -- the number of queries. Each of the next q lines contains two integers p_j and x_j ( 1 <= q p_j, x_j <= q n ) xe2 x80 x93 the description of the j -th query. For each query, print the number of suitable pairs of indices after making the change. Here are notes for first example. In first query, after update a=[2,4,1,4] . Now (1,1) , (2,2) , (3,3) , (4,4) , (1,2) , and (3,4) are suitable pairs. In second query, after update a=[2,4,3,4] . Now all subarrays of a are good. In third query, after update a=[2,1,1,4] . Now (1,1) , (2,2) , (3,3) , (4,4) , and (3,4) are suitable. '... |
Codeforces Round #825 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
175442852 | Tdyx | C2 | Oct. 10, 2022, 4:34 p.m. | OK | C# 8 | TESTS | 26 | 296 | 35430400 | ||
175502820 | oldyan | C2 | Oct. 11, 2022, 5:44 a.m. | OK | GNU C11 | TESTS | 27 | 967 | 6451200 | ||
175492734 | KbltQaQ | C2 | Oct. 11, 2022, 3:01 a.m. | OK | GNU C++14 | TESTS | 27 | 202 | 9625600 | ||
175492861 | KbltQaQ | C2 | Oct. 11, 2022, 3:04 a.m. | OK | GNU C++14 | TESTS | 27 | 217 | 9625600 | ||
175485171 | zwh2008 | C2 | Oct. 11, 2022, 12:11 a.m. | OK | GNU C++14 | TESTS | 27 | 218 | 7270400 | ||
175447498 | Hasib_16 | C2 | Oct. 10, 2022, 5:24 p.m. | OK | GNU C++14 | TESTS | 26 | 234 | 11161600 | ||
175450014 | HellPixar | C2 | Oct. 10, 2022, 5:42 p.m. | OK | GNU C++14 | TESTS | 26 | 249 | 14233600 | ||
175436171 | flowmaster | C2 | Oct. 10, 2022, 4:19 p.m. | OK | GNU C++14 | TESTS | 26 | 265 | 7270400 | ||
175458473 | .ckodser. | C2 | Oct. 10, 2022, 7:03 p.m. | OK | GNU C++14 | TESTS | 27 | 265 | 46694400 | ||
175484378 | cbdsopa | C2 | Oct. 10, 2022, 11:45 p.m. | OK | GNU C++14 | TESTS | 27 | 280 | 7270400 | ||
175486163 | wqqe223 | C2 | Oct. 11, 2022, 12:43 a.m. | OK | GNU C++14 | TESTS | 27 | 280 | 7987200 | ||
175491292 | aditya_01 | C2 | Oct. 11, 2022, 2:35 a.m. | OK | GNU C++14 | TESTS | 27 | 280 | 7987200 | ||
175496630 | acwing_meow | C2 | Oct. 11, 2022, 4:15 a.m. | OK | GNU C++17 | TESTS | 27 | 171 | 7168000 | ||
175487587 | nogondess | C2 | Oct. 11, 2022, 1:19 a.m. | OK | GNU C++17 | TESTS | 27 | 202 | 5939200 | ||
175493192 | Sugewud | C2 | Oct. 11, 2022, 3:10 a.m. | OK | GNU C++17 | TESTS | 27 | 218 | 15360000 | ||
175490989 | dreami63 | C2 | Oct. 11, 2022, 2:29 a.m. | OK | GNU C++17 | TESTS | 27 | 233 | 5632000 | ||
175493074 | hututu-7 | C2 | Oct. 11, 2022, 3:07 a.m. | OK | GNU C++17 | TESTS | 27 | 233 | 5632000 | ||
175442753 | fhhuo | C2 | Oct. 10, 2022, 4:33 p.m. | OK | GNU C++17 | TESTS | 26 | 233 | 13004800 | ||
175492836 | SummerDAway | C2 | Oct. 11, 2022, 3:03 a.m. | OK | GNU C++17 | TESTS | 27 | 233 | 59187200 | ||
175488053 | lx_tyin | C2 | Oct. 11, 2022, 1:29 a.m. | OK | GNU C++17 | TESTS | 27 | 234 | 28057600 | ||
175456307 | Turkhuuu | C2 | Oct. 10, 2022, 6:38 p.m. | OK | GNU C++17 | TESTS | 27 | 249 | 4812800 | ||
175489256 | Vanthoci | C2 | Oct. 11, 2022, 1:56 a.m. | OK | GNU C++17 | TESTS | 27 | 249 | 6451200 | ||
175491648 | EE97 | C2 | Oct. 11, 2022, 2:41 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 140 | 5632000 | ||
175499864 | xxafhixx | C2 | Oct. 11, 2022, 5:05 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 155 | 7270400 | ||
175498900 | xxafhixx | C2 | Oct. 11, 2022, 4:51 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 170 | 6451200 | ||
175500187 | Lavine | C2 | Oct. 11, 2022, 5:10 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 171 | 5632000 | ||
175453881 | fexla | C2 | Oct. 10, 2022, 6:15 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 171 | 11264000 | ||
175453376 | sandoval | C2 | Oct. 10, 2022, 6:11 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 202 | 26112000 | ||
175438764 | Kude | C2 | Oct. 10, 2022, 4:25 p.m. | OK | GNU C++17 (64) | TESTS | 26 | 217 | 34611200 | ||
175459976 | Genesis_Zero | C2 | Oct. 10, 2022, 7:21 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 218 | 7987200 | ||
175484604 | rniya | C2 | Oct. 10, 2022, 11:52 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 218 | 14950400 | ||
175446951 | hankeke | C2 | Oct. 10, 2022, 5:21 p.m. | OK | GNU C++17 (64) | TESTS | 26 | 233 | 20889600 | ||
175492731 | oldyan | C2 | Oct. 11, 2022, 3:01 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 62 | 12288000 | ||
175492415 | oldyan | C2 | Oct. 11, 2022, 2:56 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 78 | 10035200 | ||
175457507 | silxi | C2 | Oct. 10, 2022, 6:51 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 109 | 4812800 | ||
175496862 | fishcathu. | C2 | Oct. 11, 2022, 4:19 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 124 | 5632000 | ||
175496545 | fishcathu. | C2 | Oct. 11, 2022, 4:14 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 124 | 5632000 | ||
175487578 | lfc_andy26 | C2 | Oct. 11, 2022, 1:18 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 124 | 5632000 | ||
175503167 | oldyan | C2 | Oct. 11, 2022, 5:48 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 124 | 6451200 | ||
175453193 | _Cade_ | C2 | Oct. 10, 2022, 6:09 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 124 | 7987200 | ||
175450063 | VLamarca | C2 | Oct. 10, 2022, 5:42 p.m. | OK | GNU C++20 (64) | TESTS | 26 | 124 | 12800000 | ||
175499970 | yuexia | C2 | Oct. 11, 2022, 5:06 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 124 | 113868800 | ||
175496974 | dzhi | C2 | Oct. 11, 2022, 4:21 a.m. | OK | Java 11 | TESTS | 27 | 405 | 13107200 | ||
175451528 | andreyDagger | C2 | Oct. 10, 2022, 5:55 p.m. | OK | MS C++ 2017 | TESTS | 27 | 639 | 20889600 | ||
175467809 | Mirali7 | C2 | Oct. 10, 2022, 9:20 p.m. | OK | MS C++ 2017 | TESTS | 27 | 1263 | 7987200 | ||
175503220 | bokunopicolo | C2 | Oct. 11, 2022, 5:49 a.m. | OK | PyPy 3-64 | TESTS | 27 | 499 | 28979200 | ||
175484744 | sushmanth.dampur8780 | C2 | Oct. 10, 2022, 11:58 p.m. | OK | PyPy 3-64 | TESTS | 27 | 1996 | 40960000 | ||
175484790 | sushmanth.dampur8780 | C2 | Oct. 10, 2022, 11:59 p.m. | OK | PyPy 3-64 | TESTS | 27 | 2120 | 41369600 |
Back to search problems