Codeforces Round 843 (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
1775 Codeforces Round 843 (Div. 2) FINISHED False 9000 63830663 Jan. 10, 2023, 11:15 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6512 ) D Friendly Spiders PROGRAMMING dfs and similar graphs math number theory shortest paths

B"Mars is home to an unusual species of spiders -- Binary spiders. Right now, Martian scientists are observing a colony of n spiders, the i -th of which has a_i legs. Some of the spiders are friends with each other. Namely, the i -th and j -th spiders are friends if gcd(a_i, a_j) ne 1 , i. e., there is some integer k ge 2 such that a_i and a_j are simultaneously divided by k without a remainder. Here gcd(x, y) denotes the greatest common divisor (GCD) of integers x and y . Scientists have discovered that spiders can send messages. If two spiders are friends, then they can transmit a message directly in one second. Otherwise, the spider must pass the message to his friend, who in turn must pass the message to his friend, and so on until the message reaches the recipient. Let's look at an example. Suppose a spider with eight legs wants to send a message to a spider with 15 legs. He can't do it directly, because gcd(8, 15) = 1 . But he can send a message through the spider with six legs because gcd(8, 6) = 2 and gcd(6, 15) = 3 . Thus, the message will arrive in two seconds. Right now, scientists are observing how the s -th spider wants to send a message to the t -th spider. The researchers have a hypothesis that spiders always transmit messages optimally. For this reason, scientists would need a program that could calculate the minimum time to send a message and also deduce one of the optimal routes. The first line of input contains an integer n ( 2 <= n <= 3 cdot10^5 ) -- the number of spiders in the colony. The second line of input contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 3 cdot10^5 ) -- the number of legs the spiders have. The third line of input contains two integers s and t ( 1 <= s, t <= n ) --the spiders between which the message must be sent. If it is impossible to transmi"...

Tutorials

Codeforces Round #843 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
188775828 jrsy D Jan. 10, 2023, 3:28 p.m. OK GNU C11 TESTS 130 187 44953600
188778714 SergiiGolovko D Jan. 10, 2023, 3:48 p.m. OK GNU C++14 TESTS 130 155 16179200
188832234 RobertoFirmino D Jan. 11, 2023, 5 a.m. OK GNU C++14 TESTS 135 155 64307200
188778460 SergiiGolovko D Jan. 10, 2023, 3:46 p.m. OK GNU C++14 TESTS 130 156 16179200
188833475 Lin_ D Jan. 11, 2023, 5:16 a.m. OK GNU C++14 TESTS 135 170 57036800
188831837 alvinvaja D Jan. 11, 2023, 4:54 a.m. OK GNU C++14 TESTS 135 171 24883200
188833277 Lin_ D Jan. 11, 2023, 5:13 a.m. OK GNU C++14 TESTS 135 171 33894400
188817432 Hanx16 D Jan. 11, 2023, 12:18 a.m. OK GNU C++14 TESTS 135 171 68812800
188820211 kawaii0922 D Jan. 11, 2023, 1:35 a.m. OK GNU C++14 TESTS 135 186 35942400
188794681 MrRD D Jan. 10, 2023, 5:50 p.m. OK GNU C++14 TESTS 134 186 36249600
188775741 Amdadul D Jan. 10, 2023, 3:28 p.m. OK GNU C++14 TESTS 130 187 19558400
188830320 George_Rubio D Jan. 11, 2023, 4:31 a.m. OK GNU C++17 TESTS 135 124 21606400
188811439 OverSimpIified D Jan. 10, 2023, 9:22 p.m. OK GNU C++17 TESTS 134 124 22528000
188815088 AlexanderL D Jan. 10, 2023, 11:04 p.m. OK GNU C++17 TESTS 134 140 19046400
188776472 kimmoqt D Jan. 10, 2023, 3:32 p.m. OK GNU C++17 TESTS 130 140 31744000
188836523 Code.Ali D Jan. 11, 2023, 5:54 a.m. OK GNU C++17 TESTS 135 171 23552000
188819197 lk2147 D Jan. 11, 2023, 1:08 a.m. OK GNU C++17 TESTS 135 171 39731200
188835806 recurecurring D Jan. 11, 2023, 5:46 a.m. OK GNU C++17 TESTS 135 202 17612800
188830996 anhnguyen D Jan. 11, 2023, 4:42 a.m. OK GNU C++17 TESTS 135 202 29798400
188781618 _KuroNeko_ D Jan. 10, 2023, 4:08 p.m. OK GNU C++17 TESTS 132 202 34201600
188831778 willychan D Jan. 11, 2023, 4:54 a.m. OK GNU C++17 TESTS 135 202 60108800
188818101 369Pai D Jan. 11, 2023, 12:37 a.m. OK GNU C++17 (64) TESTS 135 93 196608000
188796366 MadaraUchiha. D Jan. 10, 2023, 6:03 p.m. OK GNU C++17 (64) TESTS 134 155 64409600
188827435 linxd D Jan. 11, 2023, 3:46 a.m. OK GNU C++17 (64) TESTS 135 156 71372800
188815138 _GENESIS D Jan. 10, 2023, 11:06 p.m. OK GNU C++17 (64) TESTS 134 171 96972800
188775735 lukameladze1 D Jan. 10, 2023, 3:28 p.m. OK GNU C++17 (64) TESTS 130 187 70553600
188779311 Once_I_Liked_AGirl D Jan. 10, 2023, 3:52 p.m. OK GNU C++17 (64) TESTS 130 202 63692800
188799988 Khishge_Chuchu D Jan. 10, 2023, 6:33 p.m. OK GNU C++17 (64) TESTS 134 202 70963200
188830016 Maginy_ZYX D Jan. 11, 2023, 4:26 a.m. OK GNU C++17 (64) TESTS 135 202 82124800
188801659 Sy_03 D Jan. 10, 2023, 6:50 p.m. OK GNU C++17 (64) TESTS 134 202 96870400
188786787 Egores D Jan. 10, 2023, 4:46 p.m. OK GNU C++17 (64) TESTS 134 217 42393600
188819570 _Lollipopzz_ D Jan. 11, 2023, 1:18 a.m. OK GNU C++20 (64) TESTS 135 78 9113600
188782095 Andreasyan D Jan. 10, 2023, 4:12 p.m. OK GNU C++20 (64) TESTS 132 93 24576000
188806467 Ayham_Dabah D Jan. 10, 2023, 7:50 p.m. OK GNU C++20 (64) TESTS 134 109 27340800
188783607 fhq7103 D Jan. 10, 2023, 4:22 p.m. OK GNU C++20 (64) TESTS 134 109 28774400
188806596 DGME D Jan. 10, 2023, 7:52 p.m. OK GNU C++20 (64) TESTS 134 109 101273600
188800964 kelvin_0179 D Jan. 10, 2023, 6:43 p.m. OK GNU C++20 (64) TESTS 134 124 18944000
188829270 K-423 D Jan. 11, 2023, 4:15 a.m. OK GNU C++20 (64) TESTS 135 124 23347200
188793057 AnasMaged D Jan. 10, 2023, 5:35 p.m. OK GNU C++20 (64) TESTS 134 124 24268800
188800017 mehrunesartem D Jan. 10, 2023, 6:33 p.m. OK GNU C++20 (64) TESTS 134 124 25804800
188786002 mehrunesartem D Jan. 10, 2023, 4:40 p.m. OK GNU C++20 (64) TESTS 134 124 25804800
188793043 profchi D Jan. 10, 2023, 5:35 p.m. OK Java 11 TESTS 134 763 78950400
188811227 dzhi D Jan. 10, 2023, 9:17 p.m. OK Java 11 TESTS 134 873 115507200
188810960 dzhi D Jan. 10, 2023, 9:11 p.m. OK Java 11 TESTS 134 919 115507200
188774783 humwawe D Jan. 10, 2023, 3:22 p.m. OK Java 17 TESTS 130 779 87961600
188787509 kkz666 D Jan. 10, 2023, 4:51 p.m. OK Java 17 TESTS 134 1668 260915200
188812062 Ahmed_Hosssam D Jan. 10, 2023, 9:35 p.m. OK Java 8 TESTS 134 888 129228800
188800689 sachinjaiswal D Jan. 10, 2023, 6:40 p.m. OK Java 8 TESTS 134 1200 182988800
188819941 1091857051 D Jan. 11, 2023, 1:28 a.m. OK Java 8 TESTS 135 1356 137932800
188793908 PavelChadnov D Jan. 10, 2023, 5:43 p.m. OK Kotlin 1.7 TESTS 134 1606 233369600
188811092 ivatopuria D Jan. 10, 2023, 9:14 p.m. OK PyPy 3-64 TESTS 134 529 98713600
188811006 ivatopuria D Jan. 10, 2023, 9:12 p.m. OK PyPy 3-64 TESTS 134 545 98713600
188810709 ivatopuria D Jan. 10, 2023, 9:05 p.m. OK PyPy 3-64 TESTS 134 545 98713600
188811155 ivatopuria D Jan. 10, 2023, 9:15 p.m. OK PyPy 3-64 TESTS 134 561 98713600
188810632 ivatopuria D Jan. 10, 2023, 9:03 p.m. OK PyPy 3-64 TESTS 134 592 98713600
188810615 ivatopuria D Jan. 10, 2023, 9:03 p.m. OK PyPy 3-64 TESTS 134 592 98713600
188810969 ivatopuria D Jan. 10, 2023, 9:12 p.m. OK PyPy 3-64 TESTS 134 623 98713600
188810590 KanishkGoel D Jan. 10, 2023, 9:03 p.m. OK PyPy 3-64 TESTS 134 748 163225600
188826973 tlsgusrb314 D Jan. 11, 2023, 3:39 a.m. OK PyPy 3-64 TESTS 135 795 124108800
188828741 NINGucas D Jan. 11, 2023, 4:07 a.m. OK PyPy 3-64 TESTS 135 826 134553600
188781002 cottoncotton D Jan. 10, 2023, 4:04 p.m. OK Rust 2021 TESTS 131 155 139059200
188774671 robostac D Jan. 10, 2023, 3:21 p.m. OK Rust 2021 TESTS 130 202 41267200
188790387 Swordelf D Jan. 10, 2023, 5:14 p.m. OK Rust 2021 TESTS 134 202 58163200

remove filters

Back to search problems