Codeforces Round 694 (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
1470 Codeforces Round 694 (Div. 1) FINISHED False 7200 127322663 Jan. 5, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6390 ) B Strange Definition PROGRAMMING bitmasks brute force data structures graphs math number theory

B'Let us call two integers x and y adjacent if frac{lcm(x, y)}{gcd(x, y)} is a perfect square. For example, 3 and 12 are adjacent, but 6 and 9 are not. Here gcd(x, y) denotes the greatest common divisor (GCD) of integers x and y , and lcm(x, y) denotes the least common multiple (LCM) of integers x and y . You are given an array a of length n . Each second the following happens: each element a_i of the array is replaced by the product of all elements of the array (including itself), that are adjacent to the current value. Let d_i be the number of adjacent elements to a_i (including a_i itself). The beauty of the array is defined as max_{1 <= i <= n} d_i . You are given q queries: each query is described by an integer w , and you have to output the beauty of the array after w seconds. The first input line contains a single integer t ( 1 <= t <= 10^5) -- the number of test cases. The first line of each test case contains a single integer n ( 1 <= n <= 3 cdot 10^5 ) -- the length of the array. The following line contains n integers a_1, ldots, a_n ( 1 <= a_i <= 10^6 ) -- array elements. The next line contain a single integer q ( 1 <= q <= 3 cdot 10^5 ) -- the number of queries. The following q lines contain a single integer w each ( 0 <= w <= 10^{18} ) -- the queries themselves. It is guaranteed that the sum of values n over all test cases does not exceed 3 cdot 10^5 , and the sum of values q over all test cases does not exceed 3 cdot 10^5 For each query output a single integer -- the beauty of the array at the corresponding moment. In the first test case, the initial array contains elements [6, 8, 4, 2] . Element a_4=2 in this array is adjacent to a_4=2 (since frac{lcm(2, 2)}{gcd(2, 2)}= frac'...

Tutorials

86464

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
103437546 Gassa B Jan. 5, 2021, 3:44 p.m. OK D TESTS 46 592 62054400
103501612 GSHgsh B Jan. 6, 2021, 4:51 a.m. OK GNU C++11 TESTS 46 109 14233600
103473131 fishcathu. B Jan. 5, 2021, 6:52 p.m. OK GNU C++11 TESTS 46 124 9523200
103423881 juruo1086 B Jan. 5, 2021, 3:20 p.m. OK GNU C++11 TESTS 46 156 32051200
103417704 youngsystem B Jan. 5, 2021, 3:10 p.m. OK GNU C++11 TESTS 46 171 48128000
103494582 little_brush B Jan. 6, 2021, 2:37 a.m. OK GNU C++11 TESTS 46 186 19456000
103409483 ezoilearner B Jan. 5, 2021, 2:58 p.m. OK GNU C++11 TESTS 46 202 10240000
103490489 Stump B Jan. 6, 2021, 12:47 a.m. OK GNU C++11 TESTS 46 218 13004800
103490277 AquaMoon B Jan. 6, 2021, 12:41 a.m. OK GNU C++11 TESTS 46 233 11980800
103404900 Alice_foo_foo B Jan. 5, 2021, 2:52 p.m. OK GNU C++11 TESTS 46 233 20070400
103457744 Rhodoks B Jan. 5, 2021, 4:28 p.m. OK GNU C++11 TESTS 46 234 16179200
103414821 Motarack B Jan. 5, 2021, 3:06 p.m. OK GNU C++14 TESTS 46 311 12083200
103413556 al3xstr33t B Jan. 5, 2021, 3:04 p.m. OK GNU C++14 TESTS 46 311 13209600
103444452 TranLeHiep B Jan. 5, 2021, 3:58 p.m. OK GNU C++14 TESTS 46 312 9011200
103492684 oyqy1203 B Jan. 6, 2021, 1:47 a.m. OK GNU C++14 TESTS 46 312 18329600
103409537 dlalswp25 B Jan. 5, 2021, 2:58 p.m. OK GNU C++14 TESTS 46 326 12492800
103422845 kimjihoon B Jan. 5, 2021, 3:18 p.m. OK GNU C++14 TESTS 46 327 1228800
103449597 tranmanhkhai3009 B Jan. 5, 2021, 4:10 p.m. OK GNU C++14 TESTS 46 327 9011200
103474186 _Solenya_ B Jan. 5, 2021, 7:02 p.m. OK GNU C++14 TESTS 46 342 10240000
103409025 nusuntian B Jan. 5, 2021, 2:58 p.m. OK GNU C++14 TESTS 46 342 13209600
103408447 platter B Jan. 5, 2021, 2:57 p.m. OK GNU C++14 TESTS 46 342 13619200
103419861 J_B_Y B Jan. 5, 2021, 3:14 p.m. OK GNU C++17 TESTS 46 187 28057600
103408378 realcomplex B Jan. 5, 2021, 2:57 p.m. OK GNU C++17 TESTS 46 311 5222400
103414075 islingr B Jan. 5, 2021, 3:05 p.m. OK GNU C++17 TESTS 46 311 7372800
103473354 vito1036 B Jan. 5, 2021, 6:54 p.m. OK GNU C++17 TESTS 46 326 5222400
103455872 OMA B Jan. 5, 2021, 4:24 p.m. OK GNU C++17 TESTS 46 326 48128000
103414245 gs15120 B Jan. 5, 2021, 3:05 p.m. OK GNU C++17 TESTS 46 327 2457600
103404905 NiroBC B Jan. 5, 2021, 2:52 p.m. OK GNU C++17 TESTS 46 327 9216000
103450630 Wonsei B Jan. 5, 2021, 4:12 p.m. OK GNU C++17 TESTS 46 327 9728000
103442494 afterall B Jan. 5, 2021, 3:54 p.m. OK GNU C++17 TESTS 46 327 12185600
103420823 Lawali B Jan. 5, 2021, 3:15 p.m. OK GNU C++17 TESTS 46 327 12390400
103414404 LayCurse B Jan. 5, 2021, 3:05 p.m. OK GNU C++17 (64) TESTS 46 77 104755200
103415671 ecnerwala B Jan. 5, 2021, 3:07 p.m. OK GNU C++17 (64) TESTS 46 202 10035200
103493779 QAQAutoMaton B Jan. 6, 2021, 2:16 a.m. OK GNU C++17 (64) TESTS 46 217 25292800
103426018 i_am_noob B Jan. 5, 2021, 3:23 p.m. OK GNU C++17 (64) TESTS 46 218 16076800
103441177 tikul B Jan. 5, 2021, 3:52 p.m. OK GNU C++17 (64) TESTS 46 233 13516800
103414590 Rubikun B Jan. 5, 2021, 3:06 p.m. OK GNU C++17 (64) TESTS 46 248 13414400
103488832 Zztrans B Jan. 5, 2021, 11:53 p.m. OK GNU C++17 (64) TESTS 46 249 9011200
103405634 heno239 B Jan. 5, 2021, 2:53 p.m. OK GNU C++17 (64) TESTS 46 249 10444800
103422877 KevinWan B Jan. 5, 2021, 3:18 p.m. OK GNU C++17 (64) TESTS 46 249 12083200
103451307 mshiladityam B Jan. 5, 2021, 4:13 p.m. OK GNU C++17 (64) TESTS 46 264 34816000
103448691 BNL B Jan. 5, 2021, 4:08 p.m. OK Java 11 TESTS 46 326 0
103409806 uwi B Jan. 5, 2021, 2:59 p.m. OK Java 11 TESTS 46 451 12390400
103474021 anhpp B Jan. 5, 2021, 7:01 p.m. OK Java 11 TESTS 46 623 23859200
103417507 insert_cool_handle B Jan. 5, 2021, 3:10 p.m. OK Java 11 TESTS 46 654 40448000
103411112 mikit B Jan. 5, 2021, 3:01 p.m. OK Java 11 TESTS 46 670 56729600
103478117 dusty.and.rusty B Jan. 5, 2021, 7:51 p.m. OK Java 11 TESTS 46 842 30720000
103449146 dusty.and.rusty B Jan. 5, 2021, 4:09 p.m. OK Java 11 TESTS 46 889 30617600
103477592 dusty.and.rusty B Jan. 5, 2021, 7:44 p.m. OK Java 11 TESTS 46 951 30720000
103427355 skittles1412 B Jan. 5, 2021, 3:26 p.m. OK Java 11 TESTS 46 997 62464000
103498129 Magikarp1 B Jan. 6, 2021, 3:51 a.m. OK Java 11 TESTS 46 1216 115814400
103409145 dalt B Jan. 5, 2021, 2:58 p.m. OK Java 8 TESTS 46 389 92569600
103431489 pulkit1411 B Jan. 5, 2021, 3:33 p.m. OK Java 8 TESTS 46 498 41779200
103477603 godxpunk B Jan. 5, 2021, 7:44 p.m. OK Java 8 TESTS 46 576 37580800
103426172 YahiaSherif B Jan. 5, 2021, 3:24 p.m. OK Java 8 TESTS 46 670 38400000
103484615 kareem3id B Jan. 5, 2021, 9:51 p.m. OK Java 8 TESTS 46 733 34918400
103420336 Taran_1407 B Jan. 5, 2021, 3:14 p.m. OK Java 8 TESTS 46 779 34406400
103446173 martins B Jan. 5, 2021, 4:02 p.m. OK Java 8 TESTS 46 779 49459200
103435655 polyakoff B Jan. 5, 2021, 3:41 p.m. OK Java 8 TESTS 46 857 71884800
103421515 fetetriste B Jan. 5, 2021, 3:16 p.m. OK Java 8 TESTS 46 967 97689600
103441691 Megabyte B Jan. 5, 2021, 3:52 p.m. OK Java 8 TESTS 46 1138 41062400
103483895 CepGamer B Jan. 5, 2021, 9:34 p.m. OK Kotlin TESTS 46 1481 20070400
103415352 pichulia B Jan. 5, 2021, 3:07 p.m. OK MS C++ 2017 TESTS 46 670 38707200
103437622 terry_u16 B Jan. 5, 2021, 3:44 p.m. OK .NET Core C# TESTS 46 296 39833600
103452650 Yupiteru B Jan. 5, 2021, 4:16 p.m. OK .NET Core C# TESTS 46 358 53350400
103449638 mban259 B Jan. 5, 2021, 4:10 p.m. OK .NET Core C# TESTS 46 530 52531200
103432478 azukun B Jan. 5, 2021, 3:35 p.m. OK .NET Core C# TESTS 46 1045 48128000
103435704 keymoon B Jan. 5, 2021, 3:41 p.m. OK .NET Core C# TESTS 46 1435 44544000
103414650 fairy_lettuce B Jan. 5, 2021, 3:06 p.m. OK .NET Core C# TESTS 46 1622 70451200
103410548 alexwice B Jan. 5, 2021, 3 p.m. OK PyPy 2 TESTS 46 951 72294400
103444506 bcollet B Jan. 5, 2021, 3:59 p.m. OK PyPy 2 TESTS 46 1403 61132800
103482758 TheVan B Jan. 5, 2021, 9:10 p.m. OK PyPy 3 TESTS 46 638 45363200
103434820 conqueror_of_tourist B Jan. 5, 2021, 3:39 p.m. OK PyPy 3 TESTS 46 670 61235200
103443345 jimm89 B Jan. 5, 2021, 3:56 p.m. OK PyPy 3 TESTS 46 685 46694400
103480493 TheVan B Jan. 5, 2021, 8:29 p.m. OK PyPy 3 TESTS 46 810 46489600
103430477 not_tehlka B Jan. 5, 2021, 3:31 p.m. OK PyPy 3 TESTS 46 826 51507200
103481451 TheVan B Jan. 5, 2021, 8:44 p.m. OK PyPy 3 TESTS 46 872 50790400
103424239 pineriver B Jan. 5, 2021, 3:20 p.m. OK PyPy 3 TESTS 46 998 58060800
103418030 yuusanlondon B Jan. 5, 2021, 3:11 p.m. OK PyPy 3 TESTS 46 1044 41267200
103413570 chinerist B Jan. 5, 2021, 3:04 p.m. OK PyPy 3 TESTS 46 1279 41779200
103432091 marroncastle B Jan. 5, 2021, 3:34 p.m. OK PyPy 3 TESTS 46 1450 34816000
103422135 sansen B Jan. 5, 2021, 3:17 p.m. OK Rust TESTS 46 498 39424000

remove filters

Back to search problems