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 |
|---|---|---|---|---|---|---|
| 2131 | Codeforces Round 1042 (Div. 3) | FINISHED | False | 8100 | 21569123 | Aug. 10, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 877 ) | H | Sea, You & copriMe | PROGRAMMING | brute force combinatorics constructive algorithms graphs greedy math number theory |
Umi is given an array (a) of length (n), whose elements are integers between (1) and (m). She loves coprime integers and wants to find four distinct indices (p, q, r, s) ((1 \le p, q, r, s \le n)), such that (\gcd(a_p, a_q) = 1) and (\gcd(a_r, a_s) = 1)(^{\text{∗}}). If there are multiple solutions, you may output any one of them. (^{\text{∗}})(\gcd(x, y)) denotes the greatest common divisor (GCD) of integers (x) and (y). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains two integers (n) and (m) ((4 \le n \le 2 \cdot 10^5, 1 \le m \le 10^6)). The second line of each test case contains (n) integers (a_1, a_2, \dots, a_n) ((1 \le a_i \le m)). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5), and that the sum of (m) over all test cases does not exceed (10^6). For each test case: If no such set of four distinct indices exists, output one integer (0). Otherwise, output four distinct integers (p, q, r, s) ((1 \le p, q, r, s \le n)) that satisfy the condition. If there are multiple solutions, output any one of them. In the first test case, (\gcd(a_1, a_3) = \gcd(4, 9) = 1), (\gcd(a_2, a_4) = \gcd(7, 15) = 1). In the second test case, it can be shown that no such quadruple exists. |
| Codeforces Round 1042 (Div. 3) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 333448021 | CompileError404 | H | Aug. 10, 2025, 5:01 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 327 | 6451200 | ||
| 333459856 | krkushwant | H | Aug. 10, 2025, 6:37 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 328 | 6553600 | ||
| 333471067 | Quantum5hadow | H | Aug. 10, 2025, 9:38 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 436 | 9830400 | ||
| 333493614 | mdmahbuburrahman | H | Aug. 11, 2025, 5:09 a.m. | OK | C++17 (GCC 7-32) | TESTS | 38 | 499 | 24780800 | ||
| 333497102 | jiangyusong | H | Aug. 11, 2025, 5:46 a.m. | OK | C++17 (GCC 7-32) | TESTS | 38 | 531 | 1740800 | ||
| 333497450 | shivanshcoding | H | Aug. 11, 2025, 5:49 a.m. | OK | C++17 (GCC 7-32) | TESTS | 38 | 624 | 58470400 | ||
| 333467032 | Auchenai01 | H | Aug. 10, 2025, 8:15 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 702 | 13926400 | ||
| 333448800 | wahida_akter_poly | H | Aug. 10, 2025, 5:05 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 937 | 7065600 | ||
| 333461492 | kian2009 | H | Aug. 10, 2025, 6:56 p.m. | OK | C++17 (GCC 7-32) | TESTS | 37 | 968 | 55603200 | ||
| 333492997 | TrendBattles | H | Aug. 11, 2025, 5 a.m. | OK | C++17 (GCC 7-32) | TESTS | 38 | 1093 | 73932800 | ||
| 333494977 | include_BM | H | Aug. 11, 2025, 5:25 a.m. | OK | C++20 (GCC 13-64) | TESTS | 38 | 280 | 13619200 | ||
| 333492541 | Syrus | H | Aug. 11, 2025, 4:54 a.m. | OK | C++20 (GCC 13-64) | TESTS | 38 | 312 | 31948800 | ||
| 333446720 | jobseeking | H | Aug. 10, 2025, 4:55 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 327 | 20684800 | ||
| 333492579 | Syrus | H | Aug. 11, 2025, 4:55 a.m. | OK | C++20 (GCC 13-64) | TESTS | 38 | 327 | 31948800 | ||
| 333482045 | baby_awerty | H | Aug. 11, 2025, 2:23 a.m. | OK | C++20 (GCC 13-64) | TESTS | 38 | 436 | 24985600 | ||
| 333455808 | Tahirliyev | H | Aug. 10, 2025, 5:57 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 437 | 9011200 | ||
| 333489381 | Ab_hoga_real_Cumback | H | Aug. 11, 2025, 4:06 a.m. | OK | C++20 (GCC 13-64) | TESTS | 38 | 437 | 128614400 | ||
| 333489470 | volcano_2025 | H | Aug. 11, 2025, 4:08 a.m. | OK | C++20 (GCC 13-64) | TESTS | 38 | 515 | 74240000 | ||
| 333450836 | Infinity_IQ | H | Aug. 10, 2025, 5:17 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 561 | 28160000 | ||
| 333459880 | rswr | H | Aug. 10, 2025, 6:37 p.m. | OK | C++20 (GCC 13-64) | TESTS | 37 | 562 | 42086400 | ||
| 333479041 | 424479543 | H | Aug. 11, 2025, 1:37 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 38 | 140 | 6451200 | ||
| 333446405 | 424479543 | H | Aug. 10, 2025, 4:54 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 155 | 6451200 | ||
| 333478981 | 424479543 | H | Aug. 11, 2025, 1:37 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 38 | 171 | 6451200 | ||
| 333452427 | frost_ice | H | Aug. 10, 2025, 5:29 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 264 | 28262400 | ||
| 333461889 | ladnoooo | H | Aug. 10, 2025, 7 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 280 | 5222400 | ||
| 333447404 | w3haa | H | Aug. 10, 2025, 4:58 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 281 | 91238400 | ||
| 333448915 | w3haa | H | Aug. 10, 2025, 5:05 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 296 | 91238400 | ||
| 333494105 | eleven-mile | H | Aug. 11, 2025, 5:14 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 38 | 311 | 6553600 | ||
| 333458308 | warner1129 | H | Aug. 10, 2025, 6:21 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 37 | 328 | 9113600 | ||
| 333492381 | Boboge | H | Aug. 11, 2025, 4:52 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 38 | 359 | 84172800 | ||
| 333449922 | Dukkha | H | Aug. 10, 2025, 5:11 p.m. | OK | Java 21 | TESTS | 37 | 499 | 8294400 | ||
| 333491217 | Algo_Pilot | H | Aug. 11, 2025, 4:35 a.m. | OK | Java 8 | TESTS | 38 | 1671 | 218726400 | ||
| 333463331 | vlad_khmelnov | H | Aug. 10, 2025, 7:18 p.m. | OK | PyPy 3-64 | TESTS | 37 | 906 | 37888000 | ||
| 333462228 | zhou__fan | H | Aug. 10, 2025, 7:05 p.m. | OK | PyPy 3-64 | TESTS | 37 | 906 | 37888000 | ||
| 333480319 | Little_Sheep_Yawn | H | Aug. 11, 2025, 1:57 a.m. | OK | PyPy 3-64 | TESTS | 38 | 936 | 68812800 | ||
| 333492187 | IcyGirl | H | Aug. 11, 2025, 4:49 a.m. | OK | PyPy 3-64 | TESTS | 38 | 1546 | 75059200 | ||
| 333470523 | SPD_9X2 | H | Aug. 10, 2025, 9:24 p.m. | OK | PyPy 3-64 | TESTS | 37 | 1687 | 60108800 | ||
| 333491592 | IcyGirl | H | Aug. 11, 2025, 4:40 a.m. | OK | PyPy 3-64 | TESTS | 38 | 2515 | 188928000 | ||
| 333470573 | harurun4635 | H | Aug. 10, 2025, 9:25 p.m. | OK | PyPy 3-64 | TESTS | 37 | 2890 | 71782400 | ||
| 333478775 | junjiema523 | H | Aug. 11, 2025, 1:33 a.m. | OK | Rust 2024 | TESTS | 38 | 483 | 37785600 | ||
| 333478709 | junjiema523 | H | Aug. 11, 2025, 1:32 a.m. | OK | Rust 2024 | TESTS | 38 | 827 | 14131200 | ||
| 333454703 | Ming_Xu | H | Aug. 10, 2025, 5:47 p.m. | OK | Rust 2024 | TESTS | 37 | 1983 | 193638400 | ||
| 333454672 | Ming_Xu | H | Aug. 10, 2025, 5:47 p.m. | OK | Rust 2024 | TESTS | 37 | 2171 | 201113600 |
Back to search problems