Codeforces Round 485 (Div. 1)

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
986 Codeforces Round 485 (Div. 1) FINISHED False 7800 209917523 May 29, 2018, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 806 ) E Prince's Problem PROGRAMMING brute force data structures math number theory trees 2900

B"Let the main characters of this problem be personages from some recent movie. New Avengers seem to make a lot of buzz. I didn't watch any part of the franchise and don't know its heroes well, but it won't stop me from using them in this problem statement. So, Thanos and Dr. Strange are doing their superhero and supervillain stuff, but then suddenly they stumble across a regular competitive programming problem. You are given a tree with n vertices. In each vertex v there is positive integer a_{v} . You have to answer q queries. Each query has a from u v x . You have to calculate prod_{w in P} gcd(x, a_{w}) mod (10^{9} + 7) , where P is a set of vertices on path from u to v . In other words, you are to calculate the product of gcd(x, a_{w}) for all vertices w on the path from u to v . As it might be large, compute it modulo 10^9+7 . Here gcd(s, t) denotes the greatest common divisor of s and t . Note that the numbers in vertices do not change after queries. I suppose that you are more interested in superhero business of Thanos and Dr. Strange than in them solving the problem. So you are invited to solve this problem instead of them. In the first line of input there is one integer n ( 1 <= n <= 10^{5} ) -- the size of the tree. In the next n-1 lines the edges of the tree are described. The i -th edge is described with two integers u_{i} and v_{i} ( 1 <= u_{i}, v_{i} <= n ) and it connects the vertices u_{i} and v_{i} . It is guaranteed that graph with these edges is a tree. In the next line there are n integers a_1, a_2, ldots, a_n ( 1 <= a_{v} <= 10^{7} ). In the next line there is one integer q ( 1 <= q <= 10^{5} ) -- the number of queries. And in the next q lines the queries are described. Each query is described with three integers u_{i} , v_{i} "...

Tutorials

Codeforces Round #485 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
38747262 consecutivelimit E May 29, 2018, 5:13 p.m. OK GNU C++ TESTS 29 467 92979200 2900
39772444 Sacrifice E June 29, 2018, 3:39 p.m. OK GNU C++ TESTS 54 483 278425600 2900
39677594 jokerwyt E June 26, 2018, 2:01 p.m. OK GNU C++ TESTS 54 561 173260800 2900
39745757 XuYipei E June 28, 2018, 2:25 p.m. OK GNU C++ TESTS 54 576 131276800 2900
38878089 tolight E June 2, 2018, 7:41 a.m. OK GNU C++ TESTS 29 607 88576000 2900
39693163 hankairu E June 27, 2018, 6:45 a.m. OK GNU C++ TESTS 54 608 86425600 2900
39677667 jokerwyt E June 26, 2018, 2:04 p.m. OK GNU C++ TESTS 54 608 173260800 2900
38763473 KirinBill E May 30, 2018, 7:16 a.m. OK GNU C++ TESTS 29 608 520806400 2900
38754188 Scut82 E May 29, 2018, 11:43 p.m. OK GNU C++ TESTS 29 654 134246400 2900
38947175 monsoon E June 4, 2018, 2:12 p.m. OK GNU C++ TESTS 29 701 181350400 2900
61100963 m_she E Sept. 23, 2019, 6:43 a.m. OK GNU C++11 TESTS 54 374 130867200 2900
61101042 star_magic_young E Sept. 23, 2019, 6:46 a.m. OK GNU C++11 TESTS 54 420 130867200 2900
57941729 tyler178 E July 29, 2019, 12:49 p.m. OK GNU C++11 TESTS 54 436 118988800 2900
61114131 bhllxsxr E Sept. 23, 2019, 12:18 p.m. OK GNU C++11 TESTS 54 467 268595200 2900
44104550 galaxyyh E Oct. 11, 2018, 8:23 a.m. OK GNU C++11 TESTS 54 483 133632000 2900
39058722 iamqzh E June 9, 2018, 3:16 a.m. OK GNU C++11 TESTS 54 498 106291200 2900
46841796 Heaplax E Dec. 10, 2018, 8:12 a.m. OK GNU C++11 TESTS 54 499 176537600 2900
61189959 luogu_bot2 E Sept. 24, 2019, 2:05 a.m. OK GNU C++11 TESTS 54 530 178380800 2900
38789176 FoolMike E May 31, 2018, 3:44 a.m. OK GNU C++11 TESTS 29 545 119500800 2900
38800655 bestFy E May 31, 2018, 11:55 a.m. OK GNU C++11 TESTS 29 545 132096000 2900
38818572 Marco_L_T E June 1, 2018, 5:14 a.m. OK GNU C++14 TESTS 29 342 133324800 2900
40932040 ReaLNero1 E July 30, 2018, 1:32 a.m. OK GNU C++14 TESTS 54 343 129945600 2900
38758057 chenyanbo E May 30, 2018, 3:37 a.m. OK GNU C++14 TESTS 29 467 452812800 2900
44757492 Toxel E Oct. 24, 2018, 4:18 a.m. OK GNU C++14 TESTS 54 499 197017600 2900
38750040 FtFall E May 29, 2018, 5:41 p.m. OK GNU C++14 TESTS 29 514 452812800 2900
38789282 Twishkle.Aevdark E May 31, 2018, 3:51 a.m. OK GNU C++14 TESTS 29 530 33894400 2900
47503869 neal E Dec. 25, 2018, 8:16 p.m. OK GNU C++14 TESTS 54 561 83251200 2900
45430298 neal E Nov. 8, 2018, 2:50 a.m. OK GNU C++14 TESTS 54 592 83251200 2900
45429872 neal E Nov. 8, 2018, 2:20 a.m. OK GNU C++14 TESTS 54 592 100556800 2900
38995480 Elegia E June 6, 2018, 1:03 p.m. OK GNU C++14 TESTS 54 607 167014400 2900
38740507 MrDindows E May 29, 2018, 4:35 p.m. OK GNU C++17 TESTS 29 545 176025600 2900
38751939 MrDindows E May 29, 2018, 9:41 p.m. OK GNU C++17 TESTS 29 560 163225600 2900
65765643 neal E Nov. 26, 2019, 5:48 p.m. OK GNU C++17 TESTS 54 577 99123200 2900
38939592 adoubiq E June 4, 2018, 9:09 a.m. OK GNU C++17 TESTS 29 577 122265600 2900
51384872 neal E March 16, 2019, 6:13 p.m. OK GNU C++17 TESTS 54 592 101785600 2900
57481548 neal E July 22, 2019, 2:39 a.m. OK GNU C++17 TESTS 54 607 102604800 2900
61041075 neal E Sept. 22, 2019, 12:25 a.m. OK GNU C++17 TESTS 54 623 102297600 2900
61040784 neal E Sept. 22, 2019, 12:06 a.m. OK GNU C++17 TESTS 54 623 102297600 2900
60283443 neal E Sept. 8, 2019, 11:24 p.m. OK GNU C++17 TESTS 54 623 102297600 2900
59409278 neal E Aug. 24, 2019, 3:09 p.m. OK GNU C++17 TESTS 54 623 102297600 2900
39199133 tri E June 12, 2018, 6:36 p.m. OK Java 8 TESTS 54 1325 268595200 2900
42347215 happybelly E Sept. 1, 2018, 11:09 p.m. OK Java 8 TESTS 54 1559 166707200 2900
38824273 uwi E June 1, 2018, 10:02 a.m. OK Java 8 TESTS 29 1793 536883200 2900
40878289 Noureldin E July 28, 2018, 9:28 a.m. OK Java 8 TESTS 54 1824 207462400 2900
38816441 Suzukaze E June 1, 2018, 2:26 a.m. OK Java 8 TESTS 29 2183 182272000 2900
42345555 happybelly E Sept. 1, 2018, 8:49 p.m. OK Java 8 TESTS 54 2402 500940800 2900
38769183 Los_Angelos_Laycurse E May 30, 2018, 10:38 a.m. OK MS C++ TESTS 29 1091 167936000 2900

remove filters

Back to search problems