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 |
---|---|---|---|---|---|---|
1742 | Codeforces Round 827 (Div. 4) | FINISHED | False | 8700 | 71508263 | Oct. 13, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 25003 ) | D | Coprime | PROGRAMMING | brute force greedy number theory |
B'Given an array of n positive integers a_1, a_2, ... , a_n ( 1 <= a_i <= 1000 ). Find the maximum value of i + j such that a_i and a_j are coprime, ^{ dagger} or -1 if no such i , j exist. For example consider the array [1, 3, 5, 2, 4, 7, 7] . The maximum value of i + j that can be obtained is 5 + 7 , since a_5 = 4 and a_7 = 7 are coprime. ^{ dagger} Two integers p and q are coprime if the only positive integer that is a divisor of both of them is 1 (that is, their greatest common divisor is 1 ). The input consists of multiple test cases. The first line contains an integer t ( 1 <= q t <= q 10 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains an integer n ( 2 <= q n <= q 2 cdot10^5 ) -- the length of the array. The following line contains n space-separated positive integers a_1 , a_2 ,..., a_n ( 1 <= q a_i <= q 1000 ) -- the elements of the array. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot10^5 . For each test case, output a single integer -- the maximum value of i + j such that i and j satisfy the condition that a_i and a_j are coprime, or output -1 in case no i , j satisfy the condition. For the first test case, we can choose i = j = 3 , with sum of indices equal to 6 , since 1 and 1 are coprime. For the second test case, we can choose i = 7 and j = 5 , with sum of indices equal to 7 + 5 = 12 , since 7 and 4 are coprime. '... |
107962 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
176087439 | darkdevil18 | D | Oct. 14, 2022, 2:25 a.m. | OK | GNU C11 | TESTS | 46 | 218 | 3686400 | ||
176087381 | darkdevil18 | D | Oct. 14, 2022, 2:24 a.m. | OK | GNU C11 | TESTS | 46 | 234 | 3686400 | ||
176087592 | darkdevil18 | D | Oct. 14, 2022, 2:27 a.m. | OK | GNU C11 | TESTS | 46 | 265 | 3686400 | ||
176059452 | Abhishek_Tewatia | D | Oct. 13, 2022, 6:25 p.m. | OK | GNU C11 | TESTS | 26 | 358 | 5324800 | ||
176101499 | Navyach1 | D | Oct. 14, 2022, 5:34 a.m. | OK | GNU C11 | TESTS | 46 | 483 | 819200 | ||
176101596 | taikon | D | Oct. 14, 2022, 5:35 a.m. | OK | GNU C++14 | TESTS | 46 | 46 | 204800 | ||
176085784 | longxr | D | Oct. 14, 2022, 2 a.m. | OK | GNU C++14 | TESTS | 46 | 62 | 1024000 | ||
176089256 | huangxinting666 | D | Oct. 14, 2022, 2:50 a.m. | OK | GNU C++14 | TESTS | 46 | 78 | 2867200 | ||
176090441 | YangyangXu | D | Oct. 14, 2022, 3:07 a.m. | OK | GNU C++14 | TESTS | 46 | 93 | 3481600 | ||
176080047 | omeganot | D | Oct. 14, 2022, 12:04 a.m. | OK | GNU C++14 | TESTS | 46 | 93 | 4505600 | ||
176083530 | peifeng | D | Oct. 14, 2022, 1:19 a.m. | OK | GNU C++14 | TESTS | 46 | 93 | 6758400 | ||
176064352 | shahrear002 | D | Oct. 13, 2022, 7:11 p.m. | OK | GNU C++14 | TESTS | 29 | 93 | 9113600 | ||
176094873 | anuraganand1619 | D | Oct. 14, 2022, 4:10 a.m. | OK | GNU C++14 | TESTS | 46 | 93 | 12697600 | ||
176083552 | peifeng | D | Oct. 14, 2022, 1:19 a.m. | OK | GNU C++14 | TESTS | 46 | 109 | 7372800 | ||
176093970 | VatsalSoni | D | Oct. 14, 2022, 3:57 a.m. | OK | GNU C++14 | TESTS | 46 | 109 | 11161600 | ||
176090875 | D336 | D | Oct. 14, 2022, 3:13 a.m. | OK | GNU C++17 | TESTS | 46 | 62 | 0 | ||
176104240 | jgoping | D | Oct. 14, 2022, 6:01 a.m. | OK | GNU C++17 | TESTS | 46 | 62 | 1024000 | ||
176065675 | Alightning | D | Oct. 13, 2022, 7:25 p.m. | OK | GNU C++17 | TESTS | 29 | 62 | 1126400 | ||
176068129 | TryAgain | D | Oct. 13, 2022, 7:53 p.m. | OK | GNU C++17 | TESTS | 29 | 62 | 1228800 | ||
176084791 | Lunasama | D | Oct. 14, 2022, 1:42 a.m. | OK | GNU C++17 | TESTS | 46 | 62 | 3891200 | ||
176056171 | yash246 | D | Oct. 13, 2022, 5:59 p.m. | OK | GNU C++17 | TESTS | 17 | 62 | 9216000 | ||
176090915 | D336 | D | Oct. 14, 2022, 3:14 a.m. | OK | GNU C++17 | TESTS | 46 | 78 | 0 | ||
176098711 | Sky_Warrior | D | Oct. 14, 2022, 5:03 a.m. | OK | GNU C++17 | TESTS | 46 | 78 | 1228800 | ||
176056719 | liuyubobobo | D | Oct. 13, 2022, 6:03 p.m. | OK | GNU C++17 | TESTS | 17 | 78 | 1945600 | ||
176086819 | FoolllsGarden | D | Oct. 14, 2022, 2:16 a.m. | OK | GNU C++17 | TESTS | 46 | 78 | 2048000 | ||
176094430 | hasan2006 | D | Oct. 14, 2022, 4:04 a.m. | OK | GNU C++17 (64) | TESTS | 46 | 62 | 16998400 | ||
176073845 | Ghassane | D | Oct. 13, 2022, 9:15 p.m. | OK | GNU C++17 (64) | TESTS | 29 | 78 | 5324800 | ||
176087438 | joao.breno.ro17 | D | Oct. 14, 2022, 2:25 a.m. | OK | GNU C++17 (64) | TESTS | 46 | 78 | 8601600 | ||
176083919 | kuluruvineeth | D | Oct. 14, 2022, 1:26 a.m. | OK | GNU C++17 (64) | TESTS | 46 | 93 | 6246400 | ||
176087914 | xinjiu | D | Oct. 14, 2022, 2:31 a.m. | OK | GNU C++17 (64) | TESTS | 46 | 124 | 6041600 | ||
176094033 | StarrySky1024 | D | Oct. 14, 2022, 3:58 a.m. | OK | GNU C++17 (64) | TESTS | 46 | 218 | 1024000 | ||
176063321 | SANKI | D | Oct. 13, 2022, 7 p.m. | OK | GNU C++17 (64) | TESTS | 29 | 218 | 1228800 | ||
176069177 | SorryMateWrongPath | D | Oct. 13, 2022, 8:05 p.m. | OK | GNU C++17 (64) | TESTS | 29 | 249 | 1331200 | ||
176069015 | maxcruickshanks | D | Oct. 13, 2022, 8:03 p.m. | OK | GNU C++17 (64) | TESTS | 29 | 249 | 4915200 | ||
176080887 | Lukasel | D | Oct. 14, 2022, 12:26 a.m. | OK | GNU C++17 (64) | TESTS | 46 | 249 | 5222400 | ||
176095909 | SummerWind | D | Oct. 14, 2022, 4:25 a.m. | OK | GNU C++20 (64) | TESTS | 46 | 31 | 819200 | ||
176076308 | BBEG | D | Oct. 13, 2022, 10:04 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 31 | 2048000 | ||
176103804 | Pravin2022 | D | Oct. 14, 2022, 5:57 a.m. | OK | GNU C++20 (64) | TESTS | 46 | 46 | 204800 | ||
176053480 | Honerad | D | Oct. 13, 2022, 5:41 p.m. | OK | GNU C++20 (64) | TESTS | 17 | 46 | 1228800 | ||
176092802 | Imrul_Anwar | D | Oct. 14, 2022, 3:40 a.m. | OK | GNU C++20 (64) | TESTS | 46 | 61 | 5632000 | ||
176089498 | Aman_j1 | D | Oct. 14, 2022, 2:53 a.m. | OK | GNU C++20 (64) | TESTS | 46 | 62 | 3276800 | ||
176053860 | stepan.karpov | D | Oct. 13, 2022, 5:43 p.m. | OK | GNU C++20 (64) | TESTS | 17 | 62 | 14950400 | ||
176063636 | Hasan_Ghulomzoda | D | Oct. 13, 2022, 7:04 p.m. | OK | GNU C++20 (64) | TESTS | 29 | 62 | 18329600 | ||
176102323 | jubs | D | Oct. 14, 2022, 5:43 a.m. | OK | GNU C++20 (64) | TESTS | 46 | 77 | 7372800 | ||
176090270 | zhulizhe666 | D | Oct. 14, 2022, 3:05 a.m. | OK | GNU C++20 (64) | TESTS | 46 | 78 | 1024000 | ||
176092886 | vietanhduong | D | Oct. 14, 2022, 3:42 a.m. | OK | Go | TESTS | 46 | 171 | 3174400 | ||
176090818 | mtarunsai1999 | D | Oct. 14, 2022, 3:12 a.m. | OK | Go | TESTS | 46 | 202 | 38195200 | ||
176093508 | graceoflives | D | Oct. 14, 2022, 3:51 a.m. | OK | Go | TESTS | 46 | 467 | 2457600 | ||
176071172 | shiro | D | Oct. 13, 2022, 8:31 p.m. | OK | Go | TESTS | 29 | 639 | 20480000 | ||
176070097 | mtarunsai1999 | D | Oct. 13, 2022, 8:16 p.m. | OK | Go | TESTS | 29 | 889 | 20480000 | ||
176070170 | mtarunsai1999 | D | Oct. 13, 2022, 8:17 p.m. | OK | Go | TESTS | 29 | 904 | 20582400 | ||
176076279 | viridian19 | D | Oct. 13, 2022, 10:04 p.m. | OK | Java 11 | TESTS | 35 | 436 | 24576000 | ||
176101729 | anub_12 | D | Oct. 14, 2022, 5:36 a.m. | OK | Java 11 | TESTS | 46 | 451 | 0 | ||
176097827 | mishraadarsh02 | D | Oct. 14, 2022, 4:51 a.m. | OK | Java 11 | TESTS | 46 | 467 | 0 | ||
176068429 | 2005224 | D | Oct. 13, 2022, 7:56 p.m. | OK | Java 11 | TESTS | 29 | 607 | 25292800 | ||
176089384 | puneetgarg2601 | D | Oct. 14, 2022, 2:51 a.m. | OK | Java 11 | TESTS | 46 | 623 | 0 | ||
176099781 | Vansha | D | Oct. 14, 2022, 5:15 a.m. | OK | Java 11 | TESTS | 46 | 654 | 0 | ||
176094173 | alimingoi | D | Oct. 14, 2022, 4 a.m. | OK | Java 11 | TESTS | 46 | 686 | 0 | ||
176061560 | _bakytov_ | D | Oct. 13, 2022, 6:44 p.m. | OK | Java 11 | TESTS | 29 | 686 | 24576000 | ||
176074584 | ETHANHUNTMI5 | D | Oct. 13, 2022, 9:29 p.m. | OK | Java 11 | TESTS | 29 | 748 | 25292800 | ||
176069605 | gurkaran0209 | D | Oct. 13, 2022, 8:10 p.m. | OK | Java 11 | TESTS | 29 | 748 | 25292800 | ||
176064910 | b1rr0 | D | Oct. 13, 2022, 7:17 p.m. | OK | Java 17 | TESTS | 29 | 280 | 43827200 | ||
176078689 | Abood19 | D | Oct. 13, 2022, 11:16 p.m. | OK | Java 17 | TESTS | 46 | 639 | 40652800 | ||
176055538 | Adar8604 | D | Oct. 13, 2022, 5:54 p.m. | OK | Java 17 | TESTS | 17 | 639 | 40755200 | ||
176077676 | mansourtalat7 | D | Oct. 13, 2022, 10:40 p.m. | OK | Java 17 | TESTS | 46 | 639 | 42086400 | ||
176055040 | Adar8604 | D | Oct. 13, 2022, 5:51 p.m. | OK | Java 17 | TESTS | 17 | 670 | 40755200 | ||
176055415 | vipin__sharma | D | Oct. 13, 2022, 5:53 p.m. | OK | Java 17 | TESTS | 17 | 732 | 40550400 | ||
176053721 | Adar8604 | D | Oct. 13, 2022, 5:42 p.m. | OK | Java 17 | TESTS | 17 | 904 | 40755200 | ||
176101006 | garuda5611 | D | Oct. 14, 2022, 5:29 a.m. | OK | Java 17 | TESTS | 46 | 935 | 1126400 | ||
176065397 | Suraj1607 | D | Oct. 13, 2022, 7:22 p.m. | OK | Java 17 | TESTS | 29 | 967 | 40652800 | ||
176062826 | Pockerman20 | D | Oct. 13, 2022, 6:55 p.m. | OK | Java 17 | TESTS | 29 | 1044 | 40857600 | ||
176055368 | mohamedhassan_c | D | Oct. 13, 2022, 5:53 p.m. | OK | Java 8 | TESTS | 17 | 140 | 18841600 | ||
176090144 | frey4 | D | Oct. 14, 2022, 3:03 a.m. | OK | Java 8 | TESTS | 46 | 171 | 0 | ||
176075060 | Mouhssine | D | Oct. 13, 2022, 9:38 p.m. | OK | Java 8 | TESTS | 35 | 483 | 20070400 | ||
176087870 | Joy__Boy | D | Oct. 14, 2022, 2:30 a.m. | OK | Java 8 | TESTS | 46 | 514 | 18944000 | ||
176054611 | KritarthaCF | D | Oct. 13, 2022, 5:48 p.m. | OK | Java 8 | TESTS | 17 | 514 | 18944000 | ||
176090898 | Ibrahimovic_The_Lion | D | Oct. 14, 2022, 3:13 a.m. | OK | Java 8 | TESTS | 46 | 529 | 0 | ||
176068477 | abhinavverma | D | Oct. 13, 2022, 7:57 p.m. | OK | Java 8 | TESTS | 29 | 545 | 19660800 | ||
176068850 | gagan_6730 | D | Oct. 13, 2022, 8:01 p.m. | OK | Java 8 | TESTS | 29 | 577 | 18841600 | ||
176103130 | Shymside | D | Oct. 14, 2022, 5:50 a.m. | OK | Java 8 | TESTS | 46 | 592 | 0 | ||
176067498 | Kaldaruly | D | Oct. 13, 2022, 7:45 p.m. | OK | Java 8 | TESTS | 29 | 592 | 19660800 | ||
176094401 | yanbin66613 | D | Oct. 14, 2022, 4:03 a.m. | OK | MS C++ 2017 | TESTS | 46 | 202 | 4096000 | ||
176083716 | sahalaxiaohaiyang | D | Oct. 14, 2022, 1:22 a.m. | OK | MS C++ 2017 | TESTS | 46 | 202 | 6041600 | ||
176069073 | adesh123 | D | Oct. 13, 2022, 8:04 p.m. | OK | MS C++ 2017 | TESTS | 29 | 358 | 1126400 | ||
176103727 | LoTFe | D | Oct. 14, 2022, 5:56 a.m. | OK | MS C++ 2017 | TESTS | 46 | 592 | 819200 | ||
176102693 | liaopengfei | D | Oct. 14, 2022, 5:46 a.m. | OK | MS C++ 2017 | TESTS | 46 | 2152 | 819200 | ||
176055432 | Neluji | D | Oct. 13, 2022, 5:53 p.m. | OK | Node.js | TESTS | 17 | 155 | 23961600 | ||
176069088 | andrey.starodubtsev | D | Oct. 13, 2022, 8:04 p.m. | OK | PyPy 3 | TESTS | 29 | 701 | 31744000 | ||
176066773 | praneeth_999 | D | Oct. 13, 2022, 7:37 p.m. | OK | PyPy 3 | TESTS | 29 | 732 | 39526400 | ||
176092009 | Midhilesh | D | Oct. 14, 2022, 3:29 a.m. | OK | PyPy 3 | TESTS | 46 | 795 | 14745600 | ||
176057788 | Amiy_Tiwari | D | Oct. 13, 2022, 6:12 p.m. | OK | PyPy 3 | TESTS | 17 | 888 | 34611200 | ||
176083969 | Homeo | D | Oct. 14, 2022, 1:27 a.m. | OK | PyPy 3 | TESTS | 46 | 904 | 30412800 | ||
176060550 | xooose | D | Oct. 13, 2022, 6:35 p.m. | OK | PyPy 3 | TESTS | 26 | 950 | 32768000 | ||
176100649 | Yash_Nandwana | D | Oct. 14, 2022, 5:25 a.m. | OK | PyPy 3 | TESTS | 46 | 1029 | 16384000 | ||
176082165 | Mrs.Zhao | D | Oct. 14, 2022, 12:53 a.m. | OK | PyPy 3 | TESTS | 46 | 1169 | 32665600 | ||
176079241 | aneesh2002 | D | Oct. 13, 2022, 11:35 p.m. | OK | PyPy 3 | TESTS | 46 | 1512 | 32460800 | ||
176057585 | mrdhnv | D | Oct. 13, 2022, 6:10 p.m. | OK | PyPy 3-64 | TESTS | 17 | 93 | 45772800 | ||
176065730 | aniketabhiraj2004 | D | Oct. 13, 2022, 7:25 p.m. | OK | PyPy 3-64 | TESTS | 29 | 108 | 51302400 | ||
176065352 | nikolatesla999001 | D | Oct. 13, 2022, 7:21 p.m. | OK | PyPy 3-64 | TESTS | 29 | 108 | 51302400 | ||
176052718 | 2momo2 | D | Oct. 13, 2022, 5:36 p.m. | OK | PyPy 3-64 | TESTS | 17 | 140 | 51097600 | ||
176068913 | shivamgarg2005 | D | Oct. 13, 2022, 8:02 p.m. | OK | PyPy 3-64 | TESTS | 29 | 249 | 61235200 | ||
176066753 | sohamm20 | D | Oct. 13, 2022, 7:37 p.m. | OK | PyPy 3-64 | TESTS | 29 | 264 | 57446400 | ||
176084723 | bokunopicolo | D | Oct. 14, 2022, 1:41 a.m. | OK | PyPy 3-64 | TESTS | 46 | 389 | 42905600 | ||
176074659 | HaisTous | D | Oct. 13, 2022, 9:30 p.m. | OK | PyPy 3-64 | TESTS | 35 | 389 | 47308800 | ||
176077194 | crapcode | D | Oct. 13, 2022, 10:28 p.m. | OK | PyPy 3-64 | TESTS | 46 | 421 | 49664000 | ||
176088421 | adheem | D | Oct. 14, 2022, 2:38 a.m. | OK | PyPy 3-64 | TESTS | 46 | 452 | 47616000 | ||
176058325 | Norghauzen | D | Oct. 13, 2022, 6:16 p.m. | OK | Python 3 | TESTS | 17 | 1591 | 17612800 | ||
176072728 | Aman_cool | D | Oct. 13, 2022, 8:56 p.m. | OK | Python 3 | TESTS | 29 | 2667 | 17305600 | ||
176055687 | hith_am | D | Oct. 13, 2022, 5:55 p.m. | OK | Python 3 | TESTS | 17 | 2698 | 14745600 | ||
176072751 | glexa | D | Oct. 13, 2022, 8:57 p.m. | OK | Python 3 | TESTS | 29 | 2932 | 17920000 | ||
176060709 | md.pranta | D | Oct. 13, 2022, 6:36 p.m. | OK | Python 3 | TESTS | 26 | 2947 | 14131200 | ||
176055501 | VaibhavLahane | D | Oct. 13, 2022, 5:54 p.m. | OK | Python 3 | TESTS | 17 | 2979 | 14131200 | ||
176077744 | chaosdevil | D | Oct. 13, 2022, 10:43 p.m. | OK | Python 3 | TESTS | 46 | 2979 | 17920000 | ||
176062489 | yogiswarvvs | D | Oct. 13, 2022, 6:52 p.m. | OK | Ruby 3 | TESTS | 29 | 1045 | 85401600 | ||
176084660 | liut | D | Oct. 14, 2022, 1:39 a.m. | OK | Rust 2021 | TESTS | 46 | 499 | 7065600 | ||
176101235 | freshnewname | D | Oct. 14, 2022, 5:31 a.m. | OK | Rust 2021 | TESTS | 46 | 608 | 15052800 |
Back to search problems