Codeforces Round 873 (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
1827 Codeforces Round 873 (Div. 1) FINISHED False 7200 47748299 May 14, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 118 ) F Copium Permutation PROGRAMMING constructive algorithms data structures greedy 3500

B'You are given a permutation a_1,a_2, ldots,a_n of the first n positive integers. A subarray [l,r] is called copium if we can rearrange it so that it becomes a sequence of consecutive integers, or more formally, if max(a_l,a_{l+1}, ldots,a_r)- min(a_l,a_{l+1}, ldots,a_r)=r-l For each k in the range [0,n] , print out the maximum number of copium subarrays of a over all ways of rearranging the last n-k elements of a . 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 <= 2 cdot 10^5 ). The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= n ). It is guaranteed that the given numbers form a permutation of length n . It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case print n+1 integers as the answers for each k in the range [0,n] . In the first test case, the answer permutations for each k are [1,2,3,4,5] , [5,4,3,2,1] , [5,2,3,4,1] , [5,2,1,3,4] , [5,2,1,4,3] , [5,2,1,4,3] . In the second test case, the answer permutations for each k are [1,2,3,4] , [2,1,3,4] , [2,1,3,4] , [2,1,4,3] , [2,1,4,3] . '...

Tutorials

Codeforces Round #873 (Div. 1 & 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
206317248 soudhamini_2000031088 F May 18, 2023, 9 a.m. OK GNU C++14 TESTS 151 343 40857600 3500
206298200 Yassinjan F May 18, 2023, 5:05 a.m. OK GNU C++14 TESTS 151 343 40857600 3500
206344919 mdshakib2003. F May 18, 2023, 1:23 p.m. OK GNU C++14 TESTS 151 358 40857600 3500
205940261 bkifhr7 F May 15, 2023, 4:30 a.m. OK GNU C++14 TESTS 151 1107 347955200 3500
205957327 2000032077cse F May 15, 2023, 8:30 a.m. OK GNU C++14 TESTS 151 1169 347955200 3500
205940071 2000030103 F May 15, 2023, 4:26 a.m. OK GNU C++14 TESTS 151 1185 347955200 3500
206224391 fullchmo F May 17, 2023, 2:44 p.m. OK GNU C++14 TESTS 151 1200 347955200 3500
206314385 klu2000031511 F May 18, 2023, 8:31 a.m. OK GNU C++17 TESTS 151 374 40857600 3500
206018156 sridharsiddi F May 15, 2023, 6:11 p.m. OK GNU C++17 TESTS 151 1138 347955200 3500
205957254 Karthik1106 F May 15, 2023, 8:29 a.m. OK GNU C++17 TESTS 151 1169 347955200 3500
206046430 Hritik12 F May 16, 2023, 4:46 a.m. OK GNU C++17 TESTS 151 1201 347955200 3500
206212905 2100031015cse F May 17, 2023, 12:57 p.m. OK GNU C++17 (64) TESTS 151 421 43929600 3500
205946820 sasisushma F May 15, 2023, 6:16 a.m. OK GNU C++17 (64) TESTS 151 841 348979200 3500
206329453 Lasya24 F May 18, 2023, 11:03 a.m. OK GNU C++20 (64) TESTS 151 264 43929600 3500
206319016 2000031264 F May 18, 2023, 9:17 a.m. OK GNU C++20 (64) TESTS 151 264 43929600 3500
206315270 2000030958 F May 18, 2023, 8:40 a.m. OK GNU C++20 (64) TESTS 151 264 43929600 3500
206193348 distiled F May 17, 2023, 9:50 a.m. OK GNU C++20 (64) TESTS 151 264 43929600 3500
206319463 klu_2000031619 F May 18, 2023, 9:21 a.m. OK GNU C++20 (64) TESTS 151 265 43929600 3500
206443729 2100030666.cseh F May 19, 2023, 12:12 p.m. OK GNU C++20 (64) TESTS 151 296 43929600 3500
206032718 Sputnik1234 F May 15, 2023, 10:11 p.m. OK GNU C++20 (64) TESTS 151 779 348979200 3500
206032597 Sputnik1234 F May 15, 2023, 10:08 p.m. OK GNU C++20 (64) TESTS 151 779 348979200 3500
205999010 testmayank123 F May 15, 2023, 2:52 p.m. OK GNU C++20 (64) TESTS 151 779 348979200 3500
205974139 TonyStark_987 F May 15, 2023, 11:32 a.m. OK GNU C++20 (64) TESTS 151 779 348979200 3500

remove filters

Back to search problems