Codeforces Round 1067 (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
2158 Codeforces Round 1067 (Div. 2) FINISHED False 7200 11978723 Nov. 29, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 373 ) F1 Distinct GCDs (Easy Version) PROGRAMMING constructive algorithms constructive algorithms graphs graphs number theory number theory

This is the easy version of the problem. The difference between the versions is that in this version, (n \leq 700). You can hack only if you solved all versions of this problem. Legend has it that when Gauss was a young schoolboy, his teacher tasked the class with summing the integers from (1) to (100), likely as a way to keep them occupied for a while. However, young Gauss quickly came up with the formula (\text{sum} = \frac{n(n+1)}{2}) and found the answer in mere moments. Centuries later, Gauss appears before you in a nightmare with a daunting task... You are given a positive integer (n), find a sequence of integers (a_1, a_2, \ldots, a_n) such that (1 \leq a_i \leq 10^{18}) for all (1 \leq i \leq n), and the GCDs of pairwise adjacent elements of (a) are all distinct. Formally, Additionally, (a) should have the minimum possible number of distinct elements. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 200)). The description of the test cases follows. The first and only line of each test case contains a single integer (n) ((2 \leq n \leq 700)) — the size of the sequence to be found. For each test case, output (n) space-separated positive integers (a_1, a_2, \ldots, a_n) ((1 \leq a_i \leq 10^{18})) on a new line that satisfy the condition in the statement. If there are multiple solutions, print any of them. It can be proven that under the problem constraints, a solution always exists. For the second test case, the GCDs of adjacent elements are (\gcd(1, 4), \gcd(4, 4), \gcd(4, 6), \gcd(6, 6) = 1, 4, 2, 6), all of which are distinct. For the third test case, the GCDs of adjacent elements are (\gcd(4, 4), \gcd(4, 6), \gcd(6, 6), \gcd(6, 9), \gcd(9, 9), \gcd(9, 4) = 4, 2, 6, 3, 9, 1), all of which are distinct. For each test case, it can be proven that no sequence with fewer distinct elements exists such that all a

Tutorials

Codeforces Round 1067 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
351240350 haiduynguyen F1 Nov. 29, 2025, 4:26 p.m. OK C++17 (GCC 7-32) TESTS 10 62 102400
351264567 CrossFire1 F1 Nov. 29, 2025, 7:40 p.m. OK C++17 (GCC 7-32) TESTS 10 77 0
351240930 ec3e9a2e8e F1 Nov. 29, 2025, 4:27 p.m. OK C++17 (GCC 7-32) TESTS 10 77 0
351233535 zyn_ F1 Nov. 29, 2025, 4:07 p.m. OK C++17 (GCC 7-32) TESTS 10 77 204800
351239596 potato167 F1 Nov. 29, 2025, 4:24 p.m. OK C++17 (GCC 7-32) TESTS 10 93 102400
351250340 Ak_16 F1 Nov. 29, 2025, 5:30 p.m. OK C++17 (GCC 7-32) TESTS 10 93 409600
351250378 Profesor_programiranja F1 Nov. 29, 2025, 5:30 p.m. OK C++17 (GCC 7-32) TESTS 10 108 0
351230952 lanrav F1 Nov. 29, 2025, 4:01 p.m. OK C++17 (GCC 7-32) TESTS 10 108 102400
351237285 ParsaPordastan F1 Nov. 29, 2025, 4:18 p.m. OK C++17 (GCC 7-32) TESTS 10 109 0
351293789 kdisback F1 Nov. 30, 2025, 6:07 a.m. OK C++17 (GCC 7-32) TESTS 10 202 1024000
351261674 bjcb F1 Nov. 29, 2025, 7:06 p.m. OK C++20 (GCC 13-64) TESTS 10 61 102400
351288579 Misuki F1 Nov. 30, 2025, 4:56 a.m. OK C++20 (GCC 13-64) TESTS 10 62 0
351257871 denk F1 Nov. 29, 2025, 6:31 p.m. OK C++20 (GCC 13-64) TESTS 10 62 0
351240899 StarSilk F1 Nov. 29, 2025, 4:27 p.m. OK C++20 (GCC 13-64) TESTS 10 62 0
351282996 kv4yne F1 Nov. 30, 2025, 3:01 a.m. OK C++20 (GCC 13-64) TESTS 10 62 102400
351240216 Noobish_Monk F1 Nov. 29, 2025, 4:26 p.m. OK C++20 (GCC 13-64) TESTS 10 62 409600
351273801 kondasujay2 F1 Nov. 29, 2025, 10:03 p.m. OK C++20 (GCC 13-64) TESTS 10 77 0
351265943 nargestaghizadeh89 F1 Nov. 29, 2025, 7:57 p.m. OK C++20 (GCC 13-64) TESTS 10 77 0
351268717 xiapali F1 Nov. 29, 2025, 8:32 p.m. OK C++20 (GCC 13-64) TESTS 10 77 102400
351267237 Hosen_ba F1 Nov. 29, 2025, 8:12 p.m. OK C++20 (GCC 13-64) TESTS 10 77 102400
351281321 svcf F1 Nov. 30, 2025, 2:14 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
351282302 ShirayukiNoa F1 Nov. 30, 2025, 2:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 16486400
351277781 peti1234 F1 Nov. 30, 2025, 12:04 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 0
351277304 IHaveInt F1 Nov. 29, 2025, 11:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 0
351262385 adiked_21 F1 Nov. 29, 2025, 7:14 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 0
351247056 AIF_is_carving F1 Nov. 29, 2025, 5:08 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 0
351284622 snooze26h F1 Nov. 30, 2025, 3:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 102400
351235199 TTT222 F1 Nov. 29, 2025, 4:12 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 102400
351293926 maspy F1 Nov. 30, 2025, 6:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 307200
351284017 ShirayukiNoa F1 Nov. 30, 2025, 3:25 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 16486400
351252399 Samyajit125 F1 Nov. 29, 2025, 5:47 p.m. OK Java 21 TESTS 10 374 921600
351238778 SumitXorY F1 Nov. 29, 2025, 4:22 p.m. OK Java 21 TESTS 10 421 819200
351229059 Kotlinkonquer F1 Nov. 29, 2025, 3:56 p.m. OK Kotlin 1.9 TESTS 10 765 1228800
351236833 arvindf232 F1 Nov. 29, 2025, 4:17 p.m. OK Kotlin 2.2 TESTS 10 1531 20582400
351231430 Alex239 F1 Nov. 29, 2025, 4:02 p.m. OK PyPy 3-64 TESTS 10 217 9932800
351251857 smz.26 F1 Nov. 29, 2025, 5:43 p.m. OK PyPy 3-64 TESTS 10 312 13004800
351241101 smz.26 F1 Nov. 29, 2025, 4:28 p.m. OK PyPy 3-64 TESTS 10 312 13516800
351231992 Your_Hated_CP_GUY F1 Nov. 29, 2025, 4:03 p.m. OK Python 3 TESTS 10 1546 12185600
351241899 Mon_ster F1 Nov. 29, 2025, 4:30 p.m. OK Rust 2024 TESTS 10 46 0
351247876 Ming_Xu F1 Nov. 29, 2025, 5:13 p.m. OK Rust 2024 TESTS 10 296 0

remove filters

Back to search problems