Codeforces Round 942 (Div. 1)

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
1967 Codeforces Round 942 (Div. 1) FINISHED False 9000 17335499 April 30, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 70 ) F Next and Prev PROGRAMMING brute force data structures implementation 3200

B'Let p_1, ldots, p_n be a permutation of [1, ldots, n] . Let the q -subsequence of p be a permutation of [1, q] , whose elements are in the same relative order as in p_1, ldots, p_n . That is, we extract all elements not exceeding q together from p in the original order, and they make the q -subsequence of p . For a given array a , let pre(i) be the largest value satisfying pre(i) < i and a_{pre(i)} > a_i . If it does not exist, let pre(i) = -10^{100} . Let nxt(i) be the smallest value satisfying nxt(i) > i and a_{nxt(i)} > a_i . If it does not exist, let nxt(i) = 10^{100} . For each q such that 1 <= q q <= q n , let a_1, ldots, a_q be the q -subsequence of p . For each i such that 1 <= q i <= q q , pre(i) and nxt(i) will be calculated as defined. Then, you will be given some integer values of x , and for each of them you have to calculate sum limits_{i=1}^q min(nxt(i) - pre(i), x) . 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 <= q n <= q 3 cdot 10^5 ) -- the length of the permutation. The second line of each test case contains n integers p_1, ldots, p_n ( 1 <= q p_i <= q n ) -- the initial permutation. Then, for each q such that 1 <= q q <= q n in ascending order, you will be given an integer k ( 0 <= q k <= q 10^5 ), representing the number of queries for the q -subsequence. Then k numbers in a line follow: each of them is the value of x for a single query ( 1 <= q x <= q q ). It is guaranteed that the sum of n over all test cases does not exceed 3 cdot 10^5 and the sum of k over all test cases does not exceed 10^5'...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
260748645 Mihai_2010 F May 13, 2024, 6:16 a.m. OK C++14 (GCC 6-32) TESTS 31 7546 18432000 3200
261715916 luogu_bot1 F May 20, 2024, 2:56 a.m. OK C++14 (GCC 6-32) TESTS 31 11874 18124800 3200
259290497 Ashu_5 F May 3, 2024, 3 a.m. OK C++17 (GCC 7-32) TESTS 28 6952 16998400 3200
259539007 Sparkle_Twilight F May 4, 2024, 5:05 p.m. OK C++17 (GCC 7-32) TESTS 29 7061 20889600 3200
260200020 xianboyu F May 10, 2024, 4:01 a.m. OK C++17 (GCC 7-32) TESTS 31 7108 20992000 3200
259114206 ctrlcoder F May 2, 2024, 11:38 a.m. OK C++17 (GCC 7-32) TESTS 28 7171 17100800 3200
263407044 Nabuko F May 31, 2024, 4:07 a.m. OK C++17 (GCC 7-32) TESTS 31 8030 18841600 3200
261550068 fengqiyuka F May 18, 2024, 3:27 p.m. OK C++17 (GCC 7-32) TESTS 31 10780 414924800 3200
259601271 Ak_Sakal F May 5, 2024, 8:01 a.m. OK C++17 (GCC 7-32) TESTS 29 11249 20684800 3200
261471461 Ramo7fsw F May 18, 2024, 6:34 a.m. OK C++17 (GCC 7-32) TESTS 31 11405 20684800 3200
263163278 v20481A5432 F May 29, 2024, 3:35 p.m. OK C++17 (GCC 7-32) TESTS 31 11499 21708800 3200
261335601 Mona_4715 F May 17, 2024, 1:25 p.m. OK C++17 (GCC 7-32) TESTS 31 11733 20684800 3200
259689860 N_z__ F May 6, 2024, 12:15 a.m. OK C++20 (GCC 13-64) TESTS 30 5514 28774400 3200
259489941 negative1 F May 4, 2024, 10:04 a.m. OK C++20 (GCC 13-64) TESTS 29 5967 24985600 3200
259360144 N_z__ F May 3, 2024, 1:03 p.m. OK C++20 (GCC 13-64) TESTS 28 6030 21299200 3200
259355827 N_z_ F May 3, 2024, 12:29 p.m. OK C++20 (GCC 13-64) TESTS 28 6233 22732800 3200
260048297 kemOn09 F May 8, 2024, 8:49 p.m. OK C++20 (GCC 13-64) TESTS 31 7561 23244800 3200
259639637 Tom66 F May 5, 2024, 1:36 p.m. OK C++20 (GCC 13-64) TESTS 29 8062 28160000 3200
259378092 rui_er F May 3, 2024, 3:08 p.m. OK C++20 (GCC 13-64) TESTS 28 8296 26726400 3200
259355786 N_z_ F May 3, 2024, 12:29 p.m. OK C++20 (GCC 13-64) TESTS 28 10109 26828800 3200
259426935 maroonrk F May 3, 2024, 10:24 p.m. OK C++20 (GCC 13-64) TESTS 29 10218 34304000 3200
259426916 maroonrk F May 3, 2024, 10:24 p.m. OK C++20 (GCC 13-64) TESTS 29 10421 34713600 3200

remove filters

Back to search problems