Codeforces Round 731 (Div. 3)

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
1547 Codeforces Round 731 (Div. 3) FINISHED False 8100 111252263 July 10, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6017 ) F Array Stabilization (GCD version) PROGRAMMING binary search constructive algorithms data structures number theory two pointers

B"You are given an array of positive integers a = [a_0, a_1, ... , a_{n - 1}] ( n ge 2 ). In one step, the array a is replaced with another array of length n , in which each element is the greatest common divisor (GCD) of two neighboring elements (the element itself and its right neighbor; consider that the right neighbor of the (n - 1) -th element is the 0 -th element). Formally speaking, a new array b = [b_0, b_1, ... , b_{n - 1}] is being built from array a = [a_0, a_1, ... , a_{n - 1}] such that b_i = gcd(a_i, a_{(i + 1) mod n}) , where gcd(x, y) is the greatest common divisor of x and y , and x mod y is the remainder of x dividing by y . In one step the array b is built and then the array a is replaced with b (that is, the assignment a := b is taking place). For example, if a = [16, 24, 10, 5] then b = [ gcd(16, 24) , gcd(24, 10) , gcd(10, 5) , gcd(5, 16)] = [8, 2, 5, 1] . Thus, after one step the array a = [16, 24, 10, 5] will be equal to [8, 2, 5, 1] . For a given array a , find the minimum number of steps after which all values a_i become equal (that is, a_0 = a_1 = ... = a_{n - 1} ). If the original array a consists of identical elements then consider the number of steps is equal to 0 . The first line contains an integer t ( 1 <= t <= 10^4 ). Then t test cases follow. Each test case contains two lines. The first line contains an integer n ( 2 <= n <= 2 cdot 10^5 ) -- length of the sequence a . The second line contains n integers a_0, a_1, ... , a_{n - 1} ( 1 <= a_i <= 10^6 ). It is guaranteed that the sum of n over all test cases doesn't exceed 2 cdot 10^5 . Print t numbers -- answers for each test case. "...

Tutorials

Codeforces Round #731 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
122033334 Ririko F July 11, 2021, 3:43 a.m. OK FPC TESTS 30 904 23244800
122030871 touristyyds F July 11, 2021, 2:50 a.m. OK GNU C++11 TESTS 30 93 1638400
122011495 lukey_ F July 10, 2021, 6:10 p.m. OK GNU C++11 TESTS 30 108 32051200
122033857 Bucketsmith F July 11, 2021, 3:55 a.m. OK GNU C++11 TESTS 30 140 1433600
122014254 StreamInk F July 10, 2021, 6:46 p.m. OK GNU C++11 TESTS 30 140 3174400
122009830 sas2004 F July 10, 2021, 5:51 p.m. OK GNU C++11 TESTS 30 140 6348800
121999363 Skywk F July 10, 2021, 4:45 p.m. OK GNU C++11 TESTS 30 156 32051200
122003740 Zhangjiacheng2006 F July 10, 2021, 4:56 p.m. OK GNU C++11 TESTS 30 171 20070400
122034291 Maystern F July 11, 2021, 4:03 a.m. OK GNU C++11 TESTS 30 171 25804800
122011366 Sigh F July 10, 2021, 6:08 p.m. OK GNU C++11 TESTS 30 171 26112000
122026141 dxdydw F July 11, 2021, 12:22 a.m. OK GNU C++11 TESTS 30 187 17612800
122008828 DeadPillow F July 10, 2021, 5:39 p.m. OK GNU C++14 TESTS 30 124 7987200
122002731 Agarwal.Vineet_99 F July 10, 2021, 4:52 p.m. OK GNU C++14 TESTS 30 139 2457600
122033462 JinerGenkai F July 11, 2021, 3:46 a.m. OK GNU C++14 TESTS 30 140 19353600
122000590 Copy_Paste F July 10, 2021, 4:47 p.m. OK GNU C++14 TESTS 30 140 35328000
122002569 _HossamYehia_ F July 10, 2021, 4:51 p.m. OK GNU C++14 TESTS 30 155 35328000
121999744 Copy_Paste F July 10, 2021, 4:46 p.m. OK GNU C++14 TESTS 30 155 35328000
122010773 H4XX F July 10, 2021, 6:01 p.m. OK GNU C++14 TESTS 30 186 19353600
122004830 Harsh_garg F July 10, 2021, 5:03 p.m. OK GNU C++14 TESTS 30 187 7987200
122031361 SnhPhuc F July 11, 2021, 3:01 a.m. OK GNU C++14 TESTS 30 202 18432000
122034829 _AP_ F July 11, 2021, 4:16 a.m. OK GNU C++14 TESTS 32 202 33075200
122037546 hfuuzjj F July 11, 2021, 5:15 a.m. OK GNU C++17 TESTS 32 93 1638400
122006707 fatemetmhr F July 10, 2021, 5:18 p.m. OK GNU C++17 TESTS 30 93 6246400
122008806 Llewellyn F July 10, 2021, 5:39 p.m. OK GNU C++17 TESTS 30 108 3174400
122006600 eggag32 F July 10, 2021, 5:17 p.m. OK GNU C++17 TESTS 30 108 19251200
122026972 maomao90 F July 11, 2021, 12:57 a.m. OK GNU C++17 TESTS 30 109 17612800
122021815 riya_sharma_69 F July 10, 2021, 9:24 p.m. OK GNU C++17 TESTS 30 109 17612800
122003553 codemaster108 F July 10, 2021, 4:55 p.m. OK GNU C++17 TESTS 30 124 3174400
122002483 sm1ley F July 10, 2021, 4:51 p.m. OK GNU C++17 TESTS 30 124 14438400
122037285 _comfortably_numb F July 11, 2021, 5:08 a.m. OK GNU C++17 TESTS 32 124 17203200
122008978 Yogi79 F July 10, 2021, 5:41 p.m. OK GNU C++17 TESTS 30 124 18432000
122016108 Zhabka F July 10, 2021, 7:15 p.m. OK GNU C++17 (64) TESTS 30 77 48128000
122011903 Jayce_Tang F July 10, 2021, 6:15 p.m. OK GNU C++17 (64) TESTS 30 78 1638400
122003610 bashem F July 10, 2021, 4:56 p.m. OK GNU C++17 (64) TESTS 30 78 5529600
122012120 Jayce_Tang F July 10, 2021, 6:17 p.m. OK GNU C++17 (64) TESTS 30 93 819200
122012221 Jayce_Tang F July 10, 2021, 6:19 p.m. OK GNU C++17 (64) TESTS 30 93 1638400
122016131 Zhabka F July 10, 2021, 7:15 p.m. OK GNU C++17 (64) TESTS 30 93 9625600
122015748 Zhabka F July 10, 2021, 7:09 p.m. OK GNU C++17 (64) TESTS 30 93 23449600
122006169 squishy1337 F July 10, 2021, 5:13 p.m. OK GNU C++17 (64) TESTS 30 108 17715200
122011532 Jayce_Tang F July 10, 2021, 6:10 p.m. OK GNU C++17 (64) TESTS 30 109 3174400
122017678 kevin F July 10, 2021, 7:42 p.m. OK GNU C++17 (64) TESTS 30 109 4812800
122023460 pohzipohzi F July 10, 2021, 10:22 p.m. OK Go TESTS 30 795 65433600
122004333 SaberXpro F July 10, 2021, 5 p.m. OK Java 11 TESTS 30 343 102400
122016941 spiraljava F July 10, 2021, 7:29 p.m. OK Java 11 TESTS 30 483 64204800
122019421 ak_ankit F July 10, 2021, 8:19 p.m. OK Java 11 TESTS 30 670 30412800
122035814 Dstoical F July 11, 2021, 4:40 a.m. OK Java 8 TESTS 32 467 58675200
122011788 jackiesteed F July 10, 2021, 6:13 p.m. OK Java 8 TESTS 30 592 17715200
122022420 Abdallah_Ragab00 F July 10, 2021, 9:44 p.m. OK Java 8 TESTS 30 780 76902400
122007424 NerfThis F July 10, 2021, 5:24 p.m. OK Java 8 TESTS 30 1388 46694400
122019443 sumitnitesh123 F July 10, 2021, 8:20 p.m. OK Java 8 TESTS 30 1793 3481600
122018611 tdpencil F July 10, 2021, 8:01 p.m. OK Java 8 TESTS 30 2011 35942400
122020259 tdpencil F July 10, 2021, 8:39 p.m. OK Java 8 TESTS 30 2059 35840000
122014194 honeysingh18 F July 10, 2021, 6:45 p.m. OK Java 8 TESTS 30 2074 240230400
122010290 guru1603 F July 10, 2021, 5:56 p.m. OK Java 8 TESTS 30 2215 3276800
121998800 kkkkush F July 10, 2021, 4:44 p.m. OK Java 8 TESTS 30 2230 4710400
122005089 dandoh F July 10, 2021, 5:05 p.m. OK Kotlin TESTS 30 3416 4915200
122001276 matvey22122 F July 10, 2021, 4:48 p.m. OK MS C++ 2017 TESTS 30 280 4198400
122001341 TCL F July 10, 2021, 4:48 p.m. OK MS C++ 2017 TESTS 30 327 20992000
122015211 CtrlAlt F July 10, 2021, 7:01 p.m. OK MS C++ 2017 TESTS 30 1450 8192000
122011579 shehebe F July 10, 2021, 6:11 p.m. OK PyPy 2 TESTS 30 1544 73932800
122022445 acorn11 F July 10, 2021, 9:45 p.m. OK PyPy 2 TESTS 30 1964 132608000
122035732 not_tehlka F July 11, 2021, 4:38 a.m. OK PyPy 3 TESTS 32 390 38912000
122018634 jaglike_makkar F July 10, 2021, 8:01 p.m. OK PyPy 3 TESTS 30 467 59699200
122020636 Het_Fadia F July 10, 2021, 8:48 p.m. OK PyPy 3 TESTS 30 498 59801600
122025983 augurar F July 11, 2021, 12:14 a.m. OK PyPy 3 TESTS 30 748 42598400
122007699 _aadiupadhyay_ F July 10, 2021, 5:27 p.m. OK PyPy 3 TESTS 30 2058 22732800
122001059 dmittal21 F July 10, 2021, 4:48 p.m. OK PyPy 3 TESTS 30 2511 79872000
122001875 bsamrat47 F July 10, 2021, 4:49 p.m. OK PyPy 3 TESTS 30 3837 59187200

remove filters

Back to search problems