Codeforces Round 830 (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
1732 Codeforces Round 830 (Div. 2) FINISHED False 7200 65303699 Oct. 23, 2022, 10:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2591 ) C2 Sheikh (Hard Version) PROGRAMMING binary search bitmasks brute force greedy implementation two pointers 2100

B'This is the hard version of the problem. The only difference is that in this version q = n . You are given an array of integers a_1, a_2, ldots, a_n . The cost of a subsegment of the array [l, r] , 1 <= q l <= q r <= q n , is the value f(l, r) = operatorname{sum}(l, r) - operatorname{xor}(l, r) , where operatorname{sum}(l, r) = a_l + a_{l+1} + ldots + a_r , and operatorname{xor}(l, r) = a_l oplus a_{l+1} oplus ldots oplus a_r ( oplus stands for bitwise XOR). You will have q queries. Each query is given by a pair of numbers L_i , R_i , where 1 <= q L_i <= q R_i <= q n . You need to find the subsegment [l, r] , L_i <= q l <= q r <= q R_i , with maximum value f(l, r) . If there are several answers, then among them you need to find a subsegment with the minimum length, that is, the minimum value of r - l + 1 . Each test consists of multiple test cases. The first line contains an integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains two integers n and q ( 1 <= q n <= q 10^5 , q = n ) -- the length of the array and the number of queries. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 0 <= q a_i <= q 10^9 ) -- array elements. i -th of the next q lines of each test case contains two integers L_i and R_i ( 1 <= q L_i <= q R_i <= q n ) -- the boundaries in which we need to find the segment. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . It is guaranteed that L_1 = 1 and R_1 = n . For each test case print q pairs of numbers L_i <= q l <= q r <= q R_i such that the value f(l, r) is maximum and among such the length r - l + 1 is minimum. If there are several correct answers, print any of them. In all'...

Tutorials

108327

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
177714906 mban259 C2 Oct. 24, 2022, 3:46 a.m. OK C# 10 TESTS 57 249 32460800 2100
177681405 Tdyx C2 Oct. 23, 2022, 5:49 p.m. OK C# 8 TESTS 56 390 40550400 2100
177716219 transition C2 Oct. 24, 2022, 4:10 a.m. OK GNU C++14 TESTS 58 202 1638400 2100
177709915 moying C2 Oct. 24, 2022, 2:19 a.m. OK GNU C++14 TESTS 57 202 1638400 2100
177718542 QwQr2 C2 Oct. 24, 2022, 4:54 a.m. OK GNU C++14 TESTS 58 202 18022400 2100
177638660 lost_heart_hurts C2 Oct. 23, 2022, 11:52 a.m. OK GNU C++14 TESTS 54 217 11571200 2100
177717130 taylorswift13 C2 Oct. 24, 2022, 4:29 a.m. OK GNU C++14 TESTS 58 218 2457600 2100
177633454 -2x9_21- C2 Oct. 23, 2022, 11:33 a.m. OK GNU C++14 TESTS 54 218 3174400 2100
177722495 Yu___He C2 Oct. 24, 2022, 5:54 a.m. OK GNU C++14 TESTS 58 218 16076800 2100
177713396 IG-JackeyLove C2 Oct. 24, 2022, 3:19 a.m. OK GNU C++14 TESTS 57 218 16076800 2100
177709214 __xzh C2 Oct. 24, 2022, 2:07 a.m. OK GNU C++14 TESTS 57 233 2457600 2100
177713240 Kananix C2 Oct. 24, 2022, 3:17 a.m. OK GNU C++14 TESTS 57 233 8396800 2100
177662906 Bobocan C2 Oct. 23, 2022, 3:06 p.m. OK GNU C++17 TESTS 56 62 2560000 2100
177634392 hututu-7 C2 Oct. 23, 2022, 11:36 a.m. OK GNU C++17 TESTS 54 218 1638400 2100
177674496 mohamedeltair C2 Oct. 23, 2022, 4:43 p.m. OK GNU C++17 TESTS 56 218 2457600 2100
177719825 TsReaper C2 Oct. 24, 2022, 5:15 a.m. OK GNU C++17 TESTS 58 218 2867200 2100
177668257 kissu_pari_na C2 Oct. 23, 2022, 3:48 p.m. OK GNU C++17 TESTS 56 218 9625600 2100
177712958 nianheng233 C2 Oct. 24, 2022, 3:12 a.m. OK GNU C++17 TESTS 57 233 1945600 2100
177709204 zwu2020015020 C2 Oct. 24, 2022, 2:06 a.m. OK GNU C++17 TESTS 57 233 2457600 2100
177636502 Nson C2 Oct. 23, 2022, 11:44 a.m. OK GNU C++17 TESTS 54 233 2867200 2100
177630682 ABalobanov C2 Oct. 23, 2022, 11:23 a.m. OK GNU C++17 TESTS 54 234 12083200 2100
177638613 vishaaaal C2 Oct. 23, 2022, 11:52 a.m. OK GNU C++17 TESTS 54 249 1945600 2100
177631507 HLxhh C2 Oct. 23, 2022, 11:26 a.m. OK GNU C++17 (64) TESTS 54 124 5324800 2100
177631760 NorthAutumn C2 Oct. 23, 2022, 11:27 a.m. OK GNU C++17 (64) TESTS 54 140 12185600 2100
177709159 enslaved C2 Oct. 24, 2022, 2:05 a.m. OK GNU C++17 (64) TESTS 57 155 4198400 2100
177707392 hitonanode C2 Oct. 24, 2022, 1:23 a.m. OK GNU C++17 (64) TESTS 57 171 2662400 2100
177677619 Ufimia C2 Oct. 23, 2022, 5:13 p.m. OK GNU C++17 (64) TESTS 56 187 40038400 2100
177677741 Ufimia C2 Oct. 23, 2022, 5:15 p.m. OK GNU C++17 (64) TESTS 56 187 40038400 2100
177677713 Ufimia C2 Oct. 23, 2022, 5:14 p.m. OK GNU C++17 (64) TESTS 56 187 40038400 2100
177677447 Ufimia C2 Oct. 23, 2022, 5:12 p.m. OK GNU C++17 (64) TESTS 56 187 40038400 2100
177709898 User_Carrot C2 Oct. 24, 2022, 2:19 a.m. OK GNU C++17 (64) TESTS 57 202 1638400 2100
177660566 emthrm C2 Oct. 23, 2022, 2:47 p.m. OK GNU C++17 (64) TESTS 56 202 2150400 2100
177638049 h1st C2 Oct. 23, 2022, 11:50 a.m. OK GNU C++20 (64) TESTS 54 109 4505600 2100
177714239 SSerxhs C2 Oct. 24, 2022, 3:33 a.m. OK GNU C++20 (64) TESTS 57 139 3276800 2100
177702390 Yosef.Mahmoud7 C2 Oct. 23, 2022, 10:48 p.m. OK GNU C++20 (64) TESTS 57 140 2867200 2100
177662380 alex.kudryashov C2 Oct. 23, 2022, 3:02 p.m. OK GNU C++20 (64) TESTS 56 140 3379200 2100
177681666 _c_k_r_ C2 Oct. 23, 2022, 5:51 p.m. OK GNU C++20 (64) TESTS 56 140 20070400 2100
177636100 Revolilol C2 Oct. 23, 2022, 11:42 a.m. OK GNU C++20 (64) TESTS 54 155 1638400 2100
177695590 parthtotalfun C2 Oct. 23, 2022, 8:16 p.m. OK GNU C++20 (64) TESTS 56 156 2457600 2100
177641170 WielkiGrek C2 Oct. 23, 2022, 12:01 p.m. OK GNU C++20 (64) TESTS 54 156 3993600 2100
177632348 wzkkk C2 Oct. 23, 2022, 11:29 a.m. OK GNU C++20 (64) TESTS 54 156 4198400 2100
177713243 qdhys C2 Oct. 24, 2022, 3:17 a.m. OK GNU C++20 (64) TESTS 57 156 6451200 2100
177686542 profchi C2 Oct. 23, 2022, 6:43 p.m. OK Java 11 TESTS 56 545 614400 2100
177657029 merlin_ C2 Oct. 23, 2022, 2:19 p.m. OK Java 11 TESTS 56 3525 12083200 2100
177656506 LonggHuynh C2 Oct. 23, 2022, 2:15 p.m. OK Java 17 TESTS 56 374 819200 2100
177660842 dusty.and.rusty C2 Oct. 23, 2022, 2:49 p.m. OK Java 17 TESTS 56 951 13209600 2100
177658146 invincible777 C2 Oct. 23, 2022, 2:28 p.m. OK Java 8 TESTS 56 2558 27648000 2100
177636705 ItamarNir C2 Oct. 23, 2022, 11:45 a.m. OK MS C++ 2017 TESTS 54 1091 3276800 2100
177696617 parthtotalfun C2 Oct. 23, 2022, 8:32 p.m. OK PyPy 3-64 TESTS 56 639 57241600 2100
177652006 Little_Sheep_Yawn C2 Oct. 23, 2022, 1:45 p.m. OK PyPy 3-64 TESTS 54 982 39321600 2100
177652207 Little_Sheep_Yawn C2 Oct. 23, 2022, 1:47 p.m. OK PyPy 3-64 TESTS 54 1091 40243200 2100
177670849 zouyu9631 C2 Oct. 23, 2022, 4:10 p.m. OK PyPy 3-64 TESTS 56 1185 31334400 2100
177669786 zouyu9631 C2 Oct. 23, 2022, 4:01 p.m. OK PyPy 3-64 TESTS 56 1903 31641600 2100
177722992 avnyu C2 Oct. 24, 2022, 6:01 a.m. OK Rust 2021 TESTS 58 326 57651200 2100
177720092 avnyu C2 Oct. 24, 2022, 5:19 a.m. OK Rust 2021 TESTS 58 1387 57651200 2100
177721302 avnyu C2 Oct. 24, 2022, 5:38 a.m. OK Rust 2021 TESTS 58 1403 57651200 2100
177720239 avnyu C2 Oct. 24, 2022, 5:21 a.m. OK Rust 2021 TESTS 58 1403 57651200 2100

remove filters

Back to search problems