Codeforces Round 1037 (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
2126 Codeforces Round 1037 (Div. 3) FINISHED False 8100 23642723 July 17, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 16916 ) E G-C-D, Unlucky! PROGRAMMING math number theory

Two arrays (p) and (s) of length (n) are given, where (p) is the prefix GCD(^{\text{∗}}) of some array (a), and (s) is the suffix GCD of the same array (a). In other words, if the array (a) existed, then for each (1 \le i \le n), the following equalities would hold both: (p_i = \gcd(a_1, a_2, \dots, a_i)) (s_i = \gcd(a_i, a_{i+1}, \dots, a_n)). (^{\text{∗}})(\gcd(x, y)) denotes the greatest common divisor (GCD) of integers (x) and (y). The first line contains an integer (t) ((1 \le t \le 10^4)) — the number of test cases. Each test case consists of three lines: The first line of each test case contains a single integer (n) ((1 \leq n \leq 10^5)) — the length of the array. The second line of each test case contains (n) integers (p_1, p_2, \dots, p_n) ((1 \leq p_i \le 10^9)) — the elements of the array. The third line of each test case contains (n) integers (s_1, s_2, \dots, s_n) ((1 \leq s_i \le 10^9)) — the elements of the array. It is guaranteed that the sum of all (n) across all test cases does not exceed (10^5). For each test case, output " Yes " (without quotes) if there exists an array (a) for which the given arrays (p) and (s) can be obtained, and " No " (without quotes) otherwise. You may output each letter in any case (lowercase or uppercase). For example, the strings " yEs ", " yes ", " Yes ", and " YES " will be accepted as a positive answer. For the first test case, a possible array is: (72,\ 24,\ 3,\ 6,\ 12,\ 144). For the second test case, it can be shown that such arrays do not exist. For the third test case, there exists an array: (125,\ 125,\ 125,\ 25,\ 75).

Tutorials

144845

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
329583936 DX18581611521 E July 18, 2025, 5:49 a.m. OK C++17 (GCC 7-32) TESTS 14 77 0
329578964 bardwaz E July 18, 2025, 4:55 a.m. OK C++17 (GCC 7-32) TESTS 14 77 0
329573300 serenipity E July 18, 2025, 3:44 a.m. OK C++17 (GCC 7-32) TESTS 14 77 0
329537477 imaginary_faye E July 17, 2025, 6:36 p.m. OK C++17 (GCC 7-32) TESTS 14 77 0
329580601 tkhoi13 E July 18, 2025, 5:14 a.m. OK C++17 (GCC 7-32) TESTS 14 77 102400
329577964 naveenthumati95 E July 18, 2025, 4:43 a.m. OK C++17 (GCC 7-32) TESTS 14 77 102400
329570650 pro_coder555 E July 18, 2025, 3:16 a.m. OK C++17 (GCC 7-32) TESTS 14 77 102400
329556465 Checkmate. E July 17, 2025, 11:59 p.m. OK C++17 (GCC 7-32) TESTS 14 77 819200
329533496 Single_Ready_To_Mingle E July 17, 2025, 6:03 p.m. OK C++17 (GCC 7-32) TESTS 14 77 819200
329568462 Big_Snake E July 18, 2025, 2:57 a.m. OK C++17 (GCC 7-32) TESTS 14 77 1638400
329576730 Yudiao_Vicky E July 18, 2025, 4:28 a.m. OK C++20 (GCC 13-64) TESTS 14 62 102400
329576396 ashit_72 E July 18, 2025, 4:24 a.m. OK C++20 (GCC 13-64) TESTS 14 77 0
329574476 threeways E July 18, 2025, 3:59 a.m. OK C++20 (GCC 13-64) TESTS 14 77 0
329561891 creepeer E July 18, 2025, 1:52 a.m. OK C++20 (GCC 13-64) TESTS 14 77 0
329552779 homm9k E July 17, 2025, 10:09 p.m. OK C++20 (GCC 13-64) TESTS 14 77 0
329552067 Abuseini E July 17, 2025, 9:48 p.m. OK C++20 (GCC 13-64) TESTS 14 77 0
329550002 anant_.singh_ E July 17, 2025, 9:06 p.m. OK C++20 (GCC 13-64) TESTS 14 77 0
329547877 chahatsagar E July 17, 2025, 8:33 p.m. OK C++20 (GCC 13-64) TESTS 14 77 0
329547032 0_ZerOne_1 E July 17, 2025, 8:22 p.m. OK C++20 (GCC 13-64) TESTS 14 77 0
329546589 brokeboi E July 17, 2025, 8:15 p.m. OK C++20 (GCC 13-64) TESTS 14 77 0
329580696 roniee_026 E July 18, 2025, 5:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 62 0
329571329 Mayanktan1234 E July 18, 2025, 3:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 62 0
329576867 Practico E July 18, 2025, 4:30 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 62 102400
329573789 link1k E July 18, 2025, 3:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 62 102400
329571504 22hhlin E July 18, 2025, 3:25 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 62 102400
329564398 guoeee E July 18, 2025, 2:20 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 62 102400
329584786 m32865900 E July 18, 2025, 5:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 77 0
329582046 theHope15 E July 18, 2025, 5:30 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 77 0
329580793 iotaaaaaaaaa E July 18, 2025, 5:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 77 0
329580170 acxbccx E July 18, 2025, 5:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 77 0
329558533 xXxNoobSaibotxXx E July 18, 2025, 12:55 a.m. OK D TESTS 14 124 6553600
329558819 xXxNoobSaibotxXx E July 18, 2025, 1 a.m. OK D TESTS 14 125 10752000
329571541 AlphaOrionis69 E July 18, 2025, 3:25 a.m. OK GNU C11 TESTS 14 109 2764800
329580883 BiggestFish06 E July 18, 2025, 5:17 a.m. OK Java 21 TESTS 14 264 2048000
329540552 Gurvender E July 17, 2025, 7:06 p.m. OK Java 21 TESTS 14 265 1536000
329536034 tirean E July 17, 2025, 6:24 p.m. OK Java 21 TESTS 14 281 716800
329551853 mlinear E July 17, 2025, 9:43 p.m. OK Java 21 TESTS 14 281 1024000
329539138 mohit_19 E July 17, 2025, 6:52 p.m. OK Java 21 TESTS 14 296 819200
329550779 ak_is_here E July 17, 2025, 9:21 p.m. OK Java 21 TESTS 14 296 1228800
329549429 yuvrajye E July 17, 2025, 8:57 p.m. OK Java 21 TESTS 14 311 921600
329575933 akr2803 E July 18, 2025, 4:18 a.m. OK Java 21 TESTS 14 311 1024000
329563895 jagadeeshmamilla129 E July 18, 2025, 2:15 a.m. OK Java 21 TESTS 14 312 1126400
329578071 akr2803 E July 18, 2025, 4:45 a.m. OK Java 21 TESTS 14 327 1433600
329582801 sourav2999 E July 18, 2025, 5:38 a.m. OK Java 8 TESTS 14 187 2048000
329582652 sourav2999 E July 18, 2025, 5:37 a.m. OK Java 8 TESTS 14 202 2048000
329580874 prime29 E July 18, 2025, 5:17 a.m. OK Java 8 TESTS 14 217 2764800
329539272 kasiru_69 E July 17, 2025, 6:53 p.m. OK Java 8 TESTS 14 265 10342400
329525441 bt22cse036 E July 17, 2025, 5:10 p.m. OK Java 8 TESTS 14 406 0
329579574 yanshisharma E July 18, 2025, 5:02 a.m. OK Java 8 TESTS 14 483 0
329536615 haseeb_adnaan E July 17, 2025, 6:29 p.m. OK PyPy 3 TESTS 14 327 20582400
329542913 duffel09 E July 17, 2025, 7:31 p.m. OK PyPy 3 TESTS 14 406 16281600
329582401 naman.iitd28 E July 18, 2025, 5:34 a.m. OK PyPy 3 TESTS 14 421 13107200
329573061 VivirAstucia E July 18, 2025, 3:41 a.m. OK PyPy 3-64 TESTS 14 156 17920000
329551964 Alex239 E July 17, 2025, 9:46 p.m. OK PyPy 3-64 TESTS 14 171 15974400
329581207 date727 E July 18, 2025, 5:21 a.m. OK PyPy 3-64 TESTS 14 171 17715200
329567399 smilences E July 18, 2025, 2:48 a.m. OK PyPy 3-64 TESTS 14 171 19558400
329530040 shreyas2837 E July 17, 2025, 5:38 p.m. OK PyPy 3-64 TESTS 14 186 17920000
329580432 verstrapp_1 E July 18, 2025, 5:12 a.m. OK PyPy 3-64 TESTS 14 186 22220800
329545493 IcyGirl E July 17, 2025, 8:01 p.m. OK PyPy 3-64 TESTS 14 187 23859200
329557402 aqtg674111 E July 18, 2025, 12:28 a.m. OK PyPy 3-64 TESTS 14 202 18841600
329525692 toycartoon E July 17, 2025, 5:11 p.m. OK PyPy 3-64 TESTS 14 202 19251200
329533592 ChickenTamer E July 17, 2025, 6:04 p.m. OK PyPy 3-64 TESTS 14 202 29491200
329551421 gulshanvinayak1 E July 17, 2025, 9:32 p.m. OK Python 3 TESTS 14 125 16793600
329544258 Mr.Beast192 E July 17, 2025, 7:45 p.m. OK Python 3 TESTS 14 171 29593600
329533645 Maheswar E July 17, 2025, 6:04 p.m. OK Python 3 TESTS 14 186 16793600
329529430 Cannonbolt2704 E July 17, 2025, 5:34 p.m. OK Python 3 TESTS 14 202 16281600
329525600 MadhavPeddi E July 17, 2025, 5:11 p.m. OK Python 3 TESTS 14 202 17817600
329551355 aayushprasad00691 E July 17, 2025, 9:31 p.m. OK Python 3 TESTS 14 218 16793600
329584686 Prophet05 E July 18, 2025, 5:56 a.m. OK Python 3 TESTS 14 233 16896000
329556182 BANKAI_DAYO_23 E July 17, 2025, 11:49 p.m. OK Python 3 TESTS 14 234 16793600
329546782 __FreePalestine__ E July 17, 2025, 8:18 p.m. OK Python 3 TESTS 14 249 16486400
329545497 ___a_s_1_2___ E July 17, 2025, 8:01 p.m. OK Python 3 TESTS 14 249 17203200

remove filters

Back to search problems