Codeforces Round 736 (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
1548 Codeforces Round 736 (Div. 1) FINISHED False 8700 109351463 Aug. 1, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 10169 ) B Integers Have Friends PROGRAMMING binary search data structures math number theory two pointers

B'British mathematician John Littlewood once said about Indian mathematician Srinivasa Ramanujan that "every positive integer was one of his personal friends." It turns out that positive integers can also be friends with each other! You are given an array a of distinct positive integers. Define a subarray a_i, a_{i+1}, ldots, a_j to be a friend group if and only if there exists an integer m ge 2 such that a_i bmod m = a_{i+1} bmod m = ldots = a_j bmod m , where x bmod y denotes the remainder when x is divided by y . Your friend Gregor wants to know the size of the largest friend group in a . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 2 cdot 10^4 ). Each test case begins with a line containing the integer n ( 1 <= n <= 2 cdot 10^5 ), the size of the array a . The next line contains n positive integers a_1, a_2, ldots, a_n ( 1 <= a_i <= {10}^{18} ), representing the contents of the array a . It is guaranteed that all the numbers in a are distinct. It is guaranteed that the sum of n over all test cases is less than 2 cdot 10^5 . Your output should consist of t lines. Each line should consist of a single integer, the size of the largest friend group in a . In the first test case, the array is [1,5,2,4,6] . The largest friend group is [2,4,6] , since all those numbers are congruent to 0 modulo 2 , so m=2 . In the second test case, the array is [8,2,5,10] . The largest friend group is [8,2,5] , since all those numbers are congruent to 2 modulo 3 , so m=3 . In the third case, the largest friend group is [1000,2000] . There are clearly many possible values of m that work. '...

Tutorials

Codeforces Round 736 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
124560239 Gassa B Aug. 1, 2021, 3:22 p.m. OK D TESTS 52 265 23654400
124541528 Speed_Forces B Aug. 1, 2021, 2:58 p.m. OK FPC TESTS 52 452 39628800
124621358 rainboy B Aug. 1, 2021, 9:50 p.m. OK GNU C11 TESTS 55 218 5324800
124621760 rainboy B Aug. 1, 2021, 10 p.m. OK GNU C11 TESTS 55 233 5324800
124533067 LJC00118 B Aug. 1, 2021, 2:49 p.m. OK GNU C++11 TESTS 52 140 10342400
124569357 5095187020216 B Aug. 1, 2021, 3:38 p.m. OK GNU C++11 TESTS 52 186 8704000
124562695 WDCnew B Aug. 1, 2021, 3:26 p.m. OK GNU C++11 TESTS 52 187 10342400
124559717 Shedneryan B Aug. 1, 2021, 3:21 p.m. OK GNU C++11 TESTS 52 187 11878400
124634679 ShmilyTY B Aug. 2, 2021, 2:53 a.m. OK GNU C++11 TESTS 57 187 13516800
124555521 jerry3128 B Aug. 1, 2021, 3:14 p.m. OK GNU C++11 TESTS 52 187 20377600
124543446 cjy2003 B Aug. 1, 2021, 2:59 p.m. OK GNU C++11 TESTS 52 202 5324800
124597518 gzchenben B Aug. 1, 2021, 4:44 p.m. OK GNU C++11 TESTS 52 202 5529600
124636277 hammerL B Aug. 2, 2021, 3:15 a.m. OK GNU C++11 TESTS 57 202 7168000
124561092 wyzwyz B Aug. 1, 2021, 3:23 p.m. OK GNU C++11 TESTS 52 202 11776000
124560986 ZigZagK B Aug. 1, 2021, 3:23 p.m. OK GNU C++14 TESTS 52 171 8601600
124584027 mbalsells B Aug. 1, 2021, 4:11 p.m. OK GNU C++14 TESTS 52 218 19660800
124537844 Subconscious B Aug. 1, 2021, 2:54 p.m. OK GNU C++14 TESTS 52 218 67891200
124632719 _greymatter B Aug. 2, 2021, 2:26 a.m. OK GNU C++14 TESTS 57 233 8499200
124542780 cscse B Aug. 1, 2021, 2:59 p.m. OK GNU C++14 TESTS 52 233 13516800
124585809 flyFeather B Aug. 1, 2021, 4:15 p.m. OK GNU C++14 TESTS 52 249 11776000
124555475 AhmedEzzatG B Aug. 1, 2021, 3:14 p.m. OK GNU C++14 TESTS 52 264 37171200
124558992 mathking1021 B Aug. 1, 2021, 3:20 p.m. OK GNU C++14 TESTS 52 265 13312000
124550915 Yarema.st B Aug. 1, 2021, 3:08 p.m. OK GNU C++14 TESTS 52 265 13312000
124581508 axs7384 B Aug. 1, 2021, 4:05 p.m. OK GNU C++14 TESTS 52 265 38195200
124625856 DPair B Aug. 2, 2021, 12:11 a.m. OK GNU C++17 TESTS 55 187 40345600
124576637 cat998__ B Aug. 1, 2021, 3:54 p.m. OK GNU C++17 TESTS 52 202 6963200
124544060 aa2985759 B Aug. 1, 2021, 3 p.m. OK GNU C++17 TESTS 52 217 18124800
124541080 shatovoleg B Aug. 1, 2021, 2:57 p.m. OK GNU C++17 TESTS 52 218 6963200
124588505 cuibst2 B Aug. 1, 2021, 4:22 p.m. OK GNU C++17 TESTS 52 218 8601600
124553765 Misaka23333 B Aug. 1, 2021, 3:12 p.m. OK GNU C++17 TESTS 52 218 9318400
124537586 yuto1115 B Aug. 1, 2021, 2:54 p.m. OK GNU C++17 TESTS 52 218 11161600
124538815 ainta B Aug. 1, 2021, 2:55 p.m. OK GNU C++17 TESTS 52 218 11264000
124556070 Nson B Aug. 1, 2021, 3:15 p.m. OK GNU C++17 TESTS 52 233 3788800
124549791 Riladavin B Aug. 1, 2021, 3:06 p.m. OK GNU C++17 TESTS 52 233 10649600
124545965 yosupo B Aug. 1, 2021, 3:02 p.m. OK GNU C++17 (64) TESTS 52 93 11776000
124553045 physics0523 B Aug. 1, 2021, 3:11 p.m. OK GNU C++17 (64) TESTS 52 124 13312000
124552202 LayCurse B Aug. 1, 2021, 3:09 p.m. OK GNU C++17 (64) TESTS 52 139 104243200
124592894 tkacper B Aug. 1, 2021, 4:32 p.m. OK GNU C++17 (64) TESTS 52 140 11776000
124631452 Lidox1145143344 B Aug. 2, 2021, 2:06 a.m. OK GNU C++17 (64) TESTS 56 155 12390400
124535479 Nyaan B Aug. 1, 2021, 2:51 p.m. OK GNU C++17 (64) TESTS 52 156 11161600
124535831 tfg B Aug. 1, 2021, 2:52 p.m. OK GNU C++17 (64) TESTS 52 156 12390400
124530735 orzdevinwang B Aug. 1, 2021, 2:47 p.m. OK GNU C++17 (64) TESTS 52 156 18329600
124621774 rainboy B Aug. 1, 2021, 10:01 p.m. OK GNU C++17 (64) TESTS 55 171 5836800
124627199 chctxdy68 B Aug. 2, 2021, 12:46 a.m. OK GNU C++17 (64) TESTS 55 171 7475200
124638948 0x3F B Aug. 2, 2021, 3:52 a.m. OK Go TESTS 57 592 70656000
124638799 0x3F B Aug. 2, 2021, 3:50 a.m. OK Go TESTS 57 701 70656000
124568677 clyring B Aug. 1, 2021, 3:37 p.m. OK Haskell TESTS 52 732 52633600
124546376 cirno3153 B Aug. 1, 2021, 3:02 p.m. OK Java 11 TESTS 52 468 23859200
124545749 dalt B Aug. 1, 2021, 3:02 p.m. OK Java 11 TESTS 52 514 54067200
124565767 martins B Aug. 1, 2021, 3:31 p.m. OK Java 11 TESTS 52 654 36454400
124562135 Hemose B Aug. 1, 2021, 3:25 p.m. OK Java 11 TESTS 52 763 71270400
124627801 _Body B Aug. 2, 2021, 12:58 a.m. OK Java 11 TESTS 55 904 27033600
124616626 long2142453426 B Aug. 1, 2021, 8:23 p.m. OK Java 11 TESTS 53 1029 71065600
124538124 hu_tao B Aug. 1, 2021, 2:54 p.m. OK Java 8 TESTS 52 389 20480000
124576094 NighTurs B Aug. 1, 2021, 3:52 p.m. OK Java 8 TESTS 52 561 32870400
124554334 medude B Aug. 1, 2021, 3:13 p.m. OK Java 8 TESTS 52 576 35840000
124567945 AdhmMohamed B Aug. 1, 2021, 3:36 p.m. OK Java 8 TESTS 52 701 85504000
124582158 YahiaSherif B Aug. 1, 2021, 4:06 p.m. OK Java 8 TESTS 52 919 85401600
124549872 SaveVMK B Aug. 1, 2021, 3:06 p.m. OK Java 8 TESTS 52 1107 52326400
124569894 Hakiobo B Aug. 1, 2021, 3:40 p.m. OK Kotlin TESTS 52 592 67891200
124566860 knightL B Aug. 1, 2021, 3:34 p.m. OK Kotlin TESTS 52 717 44032000
124595837 koper B Aug. 1, 2021, 4:40 p.m. OK Kotlin TESTS 52 764 46899200
124567187 alexey.enkov B Aug. 1, 2021, 3:34 p.m. OK Kotlin TESTS 52 1294 45260800
124602399 lxhgww B Aug. 1, 2021, 4:56 p.m. OK MS C++ TESTS 52 935 8908800
124616500 danilgrig B Aug. 1, 2021, 8:21 p.m. OK MS C++ 2017 TESTS 53 514 9523200
124617947 danilgrig B Aug. 1, 2021, 8:41 p.m. OK MS C++ 2017 TESTS 55 530 9523200
124617370 danilgrig B Aug. 1, 2021, 8:32 p.m. OK MS C++ 2017 TESTS 55 545 9523200
124597535 vpike B Aug. 1, 2021, 4:44 p.m. OK MS C++ 2017 TESTS 52 577 13312000
124553005 new_acc_ B Aug. 1, 2021, 3:11 p.m. OK MS C++ 2017 TESTS 52 780 11776000
124559850 azukun B Aug. 1, 2021, 3:21 p.m. OK .NET Core C# TESTS 52 498 71680000
124553680 titia B Aug. 1, 2021, 3:12 p.m. OK PyPy 3 TESTS 52 670 67584000
124583774 conqueror_of_tourist B Aug. 1, 2021, 4:10 p.m. OK PyPy 3 TESTS 52 764 49971200
124555206 chinerist B Aug. 1, 2021, 3:14 p.m. OK PyPy 3 TESTS 52 888 96153600
124567230 nasubi24 B Aug. 1, 2021, 3:34 p.m. OK PyPy 3 TESTS 52 1014 62054400
124543627 tamato B Aug. 1, 2021, 2:59 p.m. OK PyPy 3 TESTS 52 1170 157593600
124575278 Kiri8128 B Aug. 1, 2021, 3:51 p.m. OK PyPy 3 TESTS 52 1372 69017600
124596864 musdolph B Aug. 1, 2021, 4:43 p.m. OK PyPy 3 TESTS 52 1652 61849600
124538149 sansen B Aug. 1, 2021, 2:54 p.m. OK Rust TESTS 52 155 21708800
124535354 qwerty787788 B Aug. 1, 2021, 2:51 p.m. OK Rust TESTS 52 420 41267200
124594365 Russell_Emerine B Aug. 1, 2021, 4:36 p.m. OK Rust TESTS 52 499 41267200
124567785 apilat B Aug. 1, 2021, 3:35 p.m. OK Rust TESTS 52 1185 11878400

remove filters

Back to search problems