Codeforces Round 792 (Div. 1 + Div. 2)

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
1684 Codeforces Round 792 (Div. 1 + Div. 2) FINISHED False 7200 84209063 May 19, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 931 ) F Diverse Segments PROGRAMMING data structures two pointers 2600

B"You are given an array a of n integers. Also you are given m subsegments of that array. The left and the right endpoints of the j -th segment are l_j and r_j respectively. You are allowed to make no more than one operation. In that operation you choose any subsegment of the array a and replace each value on this segment with any integer (you are also allowed to keep elements the same). You have to apply this operation so that for the given m segments, the elements on each segment are distinct. More formally, for each 1 <= j <= m all elements a_{l_{j}}, a_{l_{j}+1}, ldots, a_{r_{j}-1}, a_{r_{j}} should be distinct. You don't want to use the operation on a big segment, so you have to find the smallest length of a segment, so that you can apply the operation to this segment and meet the above-mentioned conditions. If it is not needed to use this operation, the answer is 0 . The input consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 100 ) -- the number of test cases. Description of the test cases follows. The first line of each test case contains two integers n and m ( 1 <= n, m <= 2 cdot 10^5 ) -- the size of the array and the number of segments respectively. The next line contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 10^9 ) -- the elements of a . Each of the next m lines contains two integers l_j , r_j ( 1 <= l_j <= r_j <= n ) -- the left and the right endpoints of the j -th segment. It's guaranteed that the sum of n and the sum of m over all test cases does not exceed 2 cdot 10^5 . For each test case output a single integer -- the smallest length of a segment you can apply an operation on making the elements on all given segments distinct. If it is not needed to use the operation, output 0 . In the first test case you can perform"...

Tutorials

Codeforces Round #792 (Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
157727440 Sol1 F May 19, 2022, 4:31 p.m. OK GNU C++14 TESTS 131 171 19046400 2600
157725776 icfan F May 19, 2022, 4:27 p.m. OK GNU C++14 TESTS 131 186 9113600 2600
157756284 cyh_toby F May 20, 2022, 1:24 a.m. OK GNU C++14 TESTS 132 186 21606400 2600
157761072 grass8cow F May 20, 2022, 3:17 a.m. OK GNU C++14 TESTS 132 187 11878400 2600
157759913 yuziriha F May 20, 2022, 2:53 a.m. OK GNU C++14 TESTS 132 202 14233600 2600
157760901 yuziriha F May 20, 2022, 3:13 a.m. OK GNU C++14 TESTS 132 218 14233600 2600
157756599 Fire_big F May 20, 2022, 1:33 a.m. OK GNU C++14 TESTS 132 218 19251200 2600
157757407 fengqiyuka F May 20, 2022, 1:56 a.m. OK GNU C++14 TESTS 132 249 13619200 2600
157734390 yao11617 F May 19, 2022, 5:50 p.m. OK GNU C++14 TESTS 131 264 35020800 2600
157724237 huangzirui F May 19, 2022, 4:22 p.m. OK GNU C++14 TESTS 131 280 21401600 2600
157735933 fallleaves07 F May 19, 2022, 6 p.m. OK GNU C++17 TESTS 131 124 15564800 2600
157768078 acwing_meow F May 20, 2022, 5:24 a.m. OK GNU C++17 TESTS 132 171 13004800 2600
157768184 acwing_meow F May 20, 2022, 5:25 a.m. OK GNU C++17 TESTS 132 171 13414400 2600
157737011 demoralizer F May 19, 2022, 6:08 p.m. OK GNU C++17 TESTS 131 218 14028800 2600
157733129 Sexpert F May 19, 2022, 5:44 p.m. OK GNU C++17 TESTS 131 233 21196800 2600
157770544 ScottChou F May 20, 2022, 6 a.m. OK GNU C++17 TESTS 132 234 15667200 2600
157752149 patou F May 19, 2022, 10:53 p.m. OK GNU C++17 TESTS 132 249 10547200 2600
157728460 AliShahali1382 F May 19, 2022, 4:33 p.m. OK GNU C++17 TESTS 131 249 12390400 2600
157723630 subscriber F May 19, 2022, 4:20 p.m. OK GNU C++17 TESTS 131 264 23347200 2600
157758333 Fairy_Tale F May 20, 2022, 2:17 a.m. OK GNU C++17 TESTS 132 265 10342400 2600
157723502 saketh F May 19, 2022, 4:20 p.m. OK GNU C++17 (64) TESTS 131 171 10649600 2600
157726882 ChenKaifeng F May 19, 2022, 4:29 p.m. OK GNU C++17 (64) TESTS 131 171 16793600 2600
157765990 YYYLLL2021 F May 20, 2022, 4:51 a.m. OK GNU C++17 (64) TESTS 132 202 18124800 2600
157754582 basic_string F May 20, 2022, 12:28 a.m. OK GNU C++17 (64) TESTS 132 217 22835200 2600
157728294 cuiaoxiang F May 19, 2022, 4:33 p.m. OK GNU C++17 (64) TESTS 131 218 28467200 2600
157728964 xyf007 F May 19, 2022, 4:34 p.m. OK GNU C++17 (64) TESTS 131 233 24883200 2600
157723353 Xellos F May 19, 2022, 4:19 p.m. OK GNU C++17 (64) TESTS 131 234 19558400 2600
157754011 relyt871 F May 20, 2022, 12:07 a.m. OK GNU C++17 (64) TESTS 132 249 19251200 2600
157762480 syzf2222 F May 20, 2022, 3:45 a.m. OK GNU C++17 (64) TESTS 132 280 18432000 2600
157764254 errorgorn F May 20, 2022, 4:20 a.m. OK GNU C++17 (64) TESTS 132 296 24883200 2600
157758860 socpite F May 20, 2022, 2:30 a.m. OK GNU C++20 (64) TESTS 132 124 11776000 2600
157751255 Bungmint F May 19, 2022, 10:17 p.m. OK GNU C++20 (64) TESTS 132 124 14233600 2600
157723431 maximumSHOT F May 19, 2022, 4:20 p.m. OK GNU C++20 (64) TESTS 131 124 14336000 2600
157724083 erray F May 19, 2022, 4:22 p.m. OK GNU C++20 (64) TESTS 131 155 11468800 2600
157761853 drogskol F May 20, 2022, 3:33 a.m. OK GNU C++20 (64) TESTS 132 155 18841600 2600
157740965 Be_dos F May 19, 2022, 6:49 p.m. OK GNU C++20 (64) TESTS 131 156 21196800 2600
157746545 Kotoblepass F May 19, 2022, 8:16 p.m. OK GNU C++20 (64) TESTS 132 171 11468800 2600
157728188 TranGiaHuy F May 19, 2022, 4:33 p.m. OK GNU C++20 (64) TESTS 131 171 22835200 2600
157747023 Kotoblepass F May 19, 2022, 8:25 p.m. OK GNU C++20 (64) TESTS 132 186 12288000 2600
157746998 Kotoblepass F May 19, 2022, 8:25 p.m. OK GNU C++20 (64) TESTS 132 187 12288000 2600
157756707 profchi F May 20, 2022, 1:36 a.m. OK Java 11 TESTS 132 794 32256000 2600
157735478 Hakiobo F May 19, 2022, 5:56 p.m. OK Kotlin 1.4 TESTS 131 639 38912000 2600
157733498 Hakiobo F May 19, 2022, 5:46 p.m. OK Kotlin 1.4 TESTS 131 857 49459200 2600
157734798 Hakiobo F May 19, 2022, 5:52 p.m. OK Kotlin 1.4 TESTS 131 888 43622400 2600
157728451 conqueror_of_tourist F May 19, 2022, 4:33 p.m. OK PyPy 3-64 TESTS 131 1138 69427200 2600
157732990 sansen F May 19, 2022, 5:44 p.m. OK Rust 2021 TESTS 131 217 45875200 2600

remove filters

Back to search problems