Codeforces Round 548 (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
1139 Codeforces Round 548 (Div. 2) FINISHED False 7200 178640699 March 21, 2019, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 12751 ) C Edgy Trees PROGRAMMING dfs and similar ds graphs math trees 1500

B"You are given a tree (a connected undirected graph without cycles) of n vertices. Each of the n - 1 edges of the tree is colored in either black or red. You are also given an integer k . Consider sequences of k vertices. Let's call a sequence [a_1, a_2, ldots, a_k] good if it satisfies the following criterion: Consider the tree on the picture. If k=3 then the following sequences are good: [1, 4, 7] , [5, 5, 3] and [2, 3, 7] . The following sequences are not good: [1, 4, 6] , [5, 5, 5] , [3, 7, 3] . There are n^k sequences of vertices, count how many of them are good. Since this number can be quite large, print it modulo 10^9+7 . The first line contains two integers n and k ( 2 <= n <= 10^5 , 2 <= k <= 100 ), the size of the tree and the length of the vertex sequence. Each of the next n - 1 lines contains three integers u_i , v_i and x_i ( 1 <= u_i, v_i <= n , x_i in {0, 1 } ), where u_i and v_i denote the endpoints of the corresponding edge and x_i is the color of this edge ( 0 denotes red edge and 1 denotes black edge). Print the number of good sequences modulo 10^9 + 7 . In the first example, all sequences ( 4^4 ) of length 4 except the following are good: In the second example, all edges are red, hence there aren't any good sequences. "...

Tutorials

Codeforces Round #548 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
59868773 catplatypus C Sept. 1, 2019, 6:20 p.m. OK Clang++17 Diagnostics TESTS 65 1216 48230400 1500
51637742 avm C March 21, 2019, 4:19 p.m. OK D TESTS 65 46 25292800 1500
51629518 fluffyowl C March 21, 2019, 3:47 p.m. OK D TESTS 65 109 4300800 1500
51640362 ruban C March 21, 2019, 4:34 p.m. OK Delphi TESTS 65 93 241664000 1500
51771678 Oompaloompa C March 23, 2019, 6:43 p.m. OK FPC TESTS 65 77 5120000 1500
51639580 PhuongPeu C March 21, 2019, 4:29 p.m. OK FPC TESTS 65 93 6758400 1500
51646749 Stanislav666 C March 21, 2019, 5:23 p.m. OK FPC TESTS 65 155 18944000 1500
52011153 sansen C March 30, 2019, 8:38 a.m. OK GNU C11 TESTS 65 46 512000 1500
54237548 vjudge1 C May 16, 2019, 11:29 a.m. OK GNU C11 TESTS 65 62 819200 1500
52669779 luogu_bot4 C April 13, 2019, 6:54 a.m. OK GNU C++11 TESTS 65 31 614400 1500
51660231 zjgmartin C March 22, 2019, 2:07 a.m. OK GNU C++11 TESTS 65 31 1638400 1500
52154649 Even_Bao C April 1, 2019, 12:58 p.m. OK GNU C++11 TESTS 65 31 3584000 1500
52003223 luogu_bot1 C March 30, 2019, 7:11 a.m. OK GNU C++11 TESTS 65 31 4812800 1500
58538908 Frame233 C Aug. 10, 2019, 1:13 p.m. OK GNU C++11 TESTS 65 46 819200 1500
53040150 Zory C April 20, 2019, 9:23 a.m. OK GNU C++11 TESTS 65 46 819200 1500
51845597 stal_xy23z7b8 C March 26, 2019, 4:17 a.m. OK GNU C++11 TESTS 65 46 819200 1500
51639810 7mile C March 21, 2019, 4:31 p.m. OK GNU C++11 TESTS 65 46 819200 1500
58573466 Frame233 C Aug. 11, 2019, 11:18 a.m. OK GNU C++11 TESTS 65 46 819200 1500
65483706 EncodeTalker C Nov. 21, 2019, 12:32 p.m. OK GNU C++11 TESTS 65 46 819200 1500
51627921 natsugiri C March 21, 2019, 3:43 p.m. OK GNU C++14 TESTS 65 62 409600 1500
52827285 H4XeO6 C April 16, 2019, 2:16 p.m. OK GNU C++14 TESTS 65 62 819200 1500
51824643 tokitsukaze C March 25, 2019, 1:31 p.m. OK GNU C++14 TESTS 65 62 8704000 1500
51743348 KaitoHH C March 23, 2019, 6:43 a.m. OK GNU C++14 TESTS 65 77 819200 1500
52521093 ansirlee C April 9, 2019, 8:45 a.m. OK GNU C++14 TESTS 65 77 819200 1500
55863902 cuiaoxiang C June 21, 2019, 11:02 a.m. OK GNU C++14 TESTS 65 77 819200 1500
53462286 H_Love_J C April 28, 2019, 7:59 a.m. OK GNU C++14 TESTS 65 77 1228800 1500
52619402 sunnylancoder C April 11, 2019, 8:27 p.m. OK GNU C++14 TESTS 65 77 1843200 1500
53246298 Fancy_Gemini C April 24, 2019, 3:50 p.m. OK GNU C++14 TESTS 65 77 2560000 1500
51667396 kkaike C March 22, 2019, 6:42 a.m. OK GNU C++14 TESTS 65 77 3174400 1500
58242492 vjudge3 C Aug. 4, 2019, 2:31 a.m. OK GNU C++17 TESTS 65 62 2662400 1500
51848144 dmkozyrev C March 26, 2019, 6:12 a.m. OK GNU C++17 TESTS 65 62 4505600 1500
51655908 kessido C March 21, 2019, 9:31 p.m. OK GNU C++17 TESTS 65 62 8806400 1500
52643171 aisi123 C April 12, 2019, 1:20 p.m. OK GNU C++17 TESTS 65 77 819200 1500
53662554 vjudge5 C May 2, 2019, 8:35 a.m. OK GNU C++17 TESTS 65 77 819200 1500
51790623 Rick1 C March 24, 2019, 12:39 p.m. OK GNU C++17 TESTS 65 77 819200 1500
51939985 anthony1314 C March 28, 2019, 2:03 p.m. OK GNU C++17 TESTS 65 77 1228800 1500
51643321 lcj001 C March 21, 2019, 4:54 p.m. OK GNU C++17 TESTS 65 77 1536000 1500
51665949 Keven C March 22, 2019, 6:02 a.m. OK GNU C++17 TESTS 65 77 7372800 1500
51778424 jjrccop C March 24, 2019, 1:47 a.m. OK GNU C++17 TESTS 65 77 7577600 1500
51636119 fruwajacybyk C March 21, 2019, 4:11 p.m. OK Go TESTS 65 218 9728000 1500
51660463 2008061626 C March 22, 2019, 2:20 a.m. OK Go TESTS 65 233 14131200 1500
51639241 caidodo0_0 C March 21, 2019, 4:27 p.m. OK Go TESTS 65 295 5222400 1500
63931953 shubh_jha98 C Oct. 31, 2019, 2:33 p.m. OK Java 11 TESTS 65 249 16281600 1500
68383055 zhanyi_xiaolu C Jan. 8, 2020, 3:28 a.m. OK Java 11 TESTS 65 296 0 1500
64793169 Shmimy C Nov. 13, 2019, 11:57 a.m. OK Java 11 TESTS 65 546 5017600 1500
65726097 edwin.ansari C Nov. 25, 2019, 11:19 p.m. OK Java 11 TESTS 65 561 80793600 1500
67157530 samuelbohl C Dec. 18, 2019, 12:57 p.m. OK Java 11 TESTS 65 717 68710400 1500
51681916 MaxHeap C March 22, 2019, 1 p.m. OK Java 8 TESTS 65 139 0 1500
51649413 aman28rwt C March 21, 2019, 6:16 p.m. OK Java 8 TESTS 65 140 0 1500
51629819 xodiac C March 21, 2019, 3:48 p.m. OK Java 8 TESTS 65 140 0 1500
51629635 coderbond007 C March 21, 2019, 3:48 p.m. OK Java 8 TESTS 65 140 0 1500
51882066 mumeinokiseki C March 27, 2019, 2:30 a.m. OK Java 8 TESTS 65 155 0 1500
51627944 uwi C March 21, 2019, 3:44 p.m. OK Java 8 TESTS 65 155 0 1500
51631639 StayAwayFromBitches C March 21, 2019, 3:53 p.m. OK Java 8 TESTS 65 155 1433600 1500
51632708 Suunn C March 21, 2019, 3:57 p.m. OK Java 8 TESTS 65 155 5734400 1500
51650650 ahaddce C March 21, 2019, 6:41 p.m. OK Java 8 TESTS 65 170 0 1500
51663572 bazinga84 C March 22, 2019, 4:30 a.m. OK Java 8 TESTS 65 170 9625600 1500
64734048 Spheniscine C Nov. 12, 2019, 9:31 a.m. OK Kotlin TESTS 65 233 4812800 1500
60205875 rego97 C Sept. 7, 2019, 8:07 a.m. OK Kotlin TESTS 65 545 36966400 1500
60333885 Ahmadjon C Sept. 10, 2019, 7:31 a.m. OK Kotlin TESTS 65 654 55296000 1500
52250403 alykov C April 2, 2019, 11:06 p.m. OK Kotlin TESTS 65 904 66764800 1500
55675304 og.kostya C June 17, 2019, 10:03 a.m. OK Mono C# TESTS 65 62 819200 1500
54731681 camypaper C May 28, 2019, 12:55 a.m. OK Mono C# TESTS 65 124 3584000 1500
51680211 chika0707 C March 22, 2019, 12:20 p.m. OK Mono C# TESTS 65 171 10752000 1500
67645853 MiuraMiuMiu C Dec. 26, 2019, 10:07 a.m. OK Mono C# TESTS 65 202 3891200 1500
51635404 eki C March 21, 2019, 4:07 p.m. OK Mono C# TESTS 65 202 5427200 1500
52362137 nemars C April 5, 2019, 8:33 p.m. OK Mono C# TESTS 65 217 14131200 1500
51647683 omikad C March 21, 2019, 5:30 p.m. OK Mono C# TESTS 65 218 12390400 1500
52600062 nastya1199 C April 11, 2019, 11:29 a.m. OK Mono C# TESTS 65 234 13004800 1500
51775953 amit1509kumar C March 23, 2019, 9:46 p.m. OK Mono C# TESTS 65 311 78131200 1500
51630444 TrabajoNocturno C March 21, 2019, 3:50 p.m. OK Mono C# TESTS 65 311 81203200 1500
54088816 vjudge1 C May 14, 2019, 9:13 a.m. OK MS C++ TESTS 65 62 819200 1500
51674198 kaixinqi C March 22, 2019, 9:36 a.m. OK MS C++ TESTS 65 62 819200 1500
54274249 vjudge4 C May 17, 2019, 10:19 a.m. OK MS C++ TESTS 65 62 819200 1500
51859033 yp0413170434 C March 26, 2019, 12:23 p.m. OK MS C++ TESTS 65 62 1228800 1500
52482223 vjudge2 C April 8, 2019, 6:26 a.m. OK MS C++ TESTS 65 62 1638400 1500
58241776 vjudge1 C Aug. 4, 2019, 1:53 a.m. OK MS C++ TESTS 65 62 1638400 1500
51954920 vjudge4 C March 29, 2019, 12:59 a.m. OK MS C++ TESTS 65 62 2457600 1500
51859996 vjudge2 C March 26, 2019, 12:44 p.m. OK MS C++ TESTS 65 62 2457600 1500
54435755 scorpiowf C May 21, 2019, 5:20 a.m. OK MS C++ TESTS 65 62 2969600 1500
66026074 vjudge2 C Nov. 30, 2019, 8:43 a.m. OK MS C++ TESTS 65 62 4096000 1500
51844482 15872954516 C March 26, 2019, 3 a.m. OK MS C++ 2017 TESTS 65 93 409600 1500
51636436 zzq233 C March 21, 2019, 4:12 p.m. OK MS C++ 2017 TESTS 65 93 819200 1500
59197996 116c C Aug. 21, 2019, 2:48 a.m. OK MS C++ 2017 TESTS 65 93 819200 1500
54972983 Lordxx C June 2, 2019, 9:24 a.m. OK MS C++ 2017 TESTS 65 93 1228800 1500
53790695 R99 C May 5, 2019, 12:39 p.m. OK MS C++ 2017 TESTS 65 109 2150400 1500
51674988 risa243 C March 22, 2019, 10 a.m. OK MS C++ 2017 TESTS 65 109 5017600 1500
51635560 GomBu C March 21, 2019, 4:08 p.m. OK MS C++ 2017 TESTS 65 124 6758400 1500
51670625 work_hard. C March 22, 2019, 8:05 a.m. OK MS C++ 2017 TESTS 65 124 7168000 1500
51960387 AleksanderBalobanov C March 29, 2019, 6:25 a.m. OK MS C++ 2017 TESTS 65 139 10444800 1500
51641680 AsahiKokura C March 21, 2019, 4:42 p.m. OK MS C++ 2017 TESTS 65 140 5427200 1500
52574378 sash0 C April 10, 2019, 3:40 p.m. OK Ocaml TESTS 65 124 4403200 1500
51641239 c1729 C March 21, 2019, 4:39 p.m. OK PyPy 2 TESTS 65 296 10035200 1500
52314659 Mukundan314 C April 4, 2019, 4:23 p.m. OK PyPy 2 TESTS 65 296 12595200 1500
51634186 YESMAths C March 21, 2019, 4:02 p.m. OK PyPy 2 TESTS 65 327 15360000 1500
51633771 gatsko C March 21, 2019, 4:01 p.m. OK PyPy 2 TESTS 65 608 27852800 1500
51628872 LaiMeiyun C March 21, 2019, 3:46 p.m. OK PyPy 2 TESTS 65 748 8499200 1500
51634259 aeternalis1 C March 21, 2019, 4:02 p.m. OK PyPy 2 TESTS 65 810 8601600 1500
51644528 beriefing C March 21, 2019, 5:04 p.m. OK PyPy 2 TESTS 65 811 10137600 1500
51733960 veryverybad C March 23, 2019, 12:08 a.m. OK PyPy 2 TESTS 65 811 10240000 1500
55853035 anshuman16423 C June 21, 2019, 5:22 a.m. OK PyPy 2 TESTS 65 826 13619200 1500
51645179 supachai_pay C March 21, 2019, 5:10 p.m. OK PyPy 2 TESTS 65 1045 27648000 1500
51676802 meooow C March 22, 2019, 10:56 a.m. OK PyPy 3 TESTS 65 296 14643200 1500
51864602 pajenegod C March 26, 2019, 2:34 p.m. OK PyPy 3 TESTS 65 327 14438400 1500
51772754 sanvi_kiit C March 23, 2019, 7:23 p.m. OK PyPy 3 TESTS 65 373 13107200 1500
51889986 yumtam C March 27, 2019, 8:38 a.m. OK PyPy 3 TESTS 65 374 13721600 1500
51644024 abhishekbhr C March 21, 2019, 5 p.m. OK PyPy 3 TESTS 65 389 10035200 1500
51629153 titia C March 21, 2019, 3:46 p.m. OK PyPy 3 TESTS 65 436 19865600 1500
51654671 EA5 C March 21, 2019, 8:39 p.m. OK PyPy 3 TESTS 65 436 22220800 1500
51877967 bkalra92 C March 26, 2019, 8:45 p.m. OK PyPy 3 TESTS 65 452 14131200 1500
51832369 kekedu C March 25, 2019, 4:46 p.m. OK PyPy 3 TESTS 65 482 17817600 1500
56055404 michaellee4 C June 25, 2019, 10:47 p.m. OK PyPy 3 TESTS 65 483 14745600 1500
51637515 baala C March 21, 2019, 4:17 p.m. OK Python 2 TESTS 65 530 3891200 1500
52363963 nealzane C April 5, 2019, 10:12 p.m. OK Python 2 TESTS 65 577 4608000 1500
51661478 allonsy_kim C March 22, 2019, 3:02 a.m. OK Python 2 TESTS 65 577 9113600 1500
55017920 shubhankarsharma00 C June 3, 2019, 1:18 p.m. OK Python 2 TESTS 65 607 13926400 1500
51642345 pa.n.ik C March 21, 2019, 4:47 p.m. OK Python 2 TESTS 65 623 112025600 1500
55017694 shubhankarsharma00 C June 3, 2019, 1:10 p.m. OK Python 2 TESTS 65 639 14233600 1500
51639128 SoSooding C March 21, 2019, 4:26 p.m. OK Python 2 TESTS 65 655 10547200 1500
55098154 linkRs C June 4, 2019, 6:24 p.m. OK Python 3 TESTS 65 358 3379200 1500
51686270 purple_haze1 C March 22, 2019, 2:40 p.m. OK Python 3 TESTS 65 452 2457600 1500
51643670 e2346666 C March 21, 2019, 4:57 p.m. OK Python 3 TESTS 65 483 3379200 1500
51659212 tjdwo5313 C March 22, 2019, 1:01 a.m. OK Python 3 TESTS 65 498 3686400 1500
51659203 tjdwo5313 C March 22, 2019, 1:01 a.m. OK Python 3 TESTS 65 499 3379200 1500
55572286 Russell_Emerine C June 14, 2019, 7:43 p.m. OK Python 3 TESTS 65 514 1638400 1500
51770783 III_Wolverine_III C March 23, 2019, 6:16 p.m. OK Python 3 TESTS 65 514 16588800 1500
51755321 and_lvov_sky C March 23, 2019, 11:18 a.m. OK Python 3 TESTS 65 529 9113600 1500
54397880 vjudge3 C May 19, 2019, 10:18 p.m. OK Python 3 TESTS 65 530 9830400 1500
54397874 pauloleitao C May 19, 2019, 10:17 p.m. OK Python 3 TESTS 65 530 9830400 1500
51754434 georgeroman C March 23, 2019, 10:58 a.m. OK Ruby TESTS 65 545 21913600 1500
51632405 yakamoto C March 21, 2019, 3:56 p.m. OK Scala TESTS 65 499 0 1500
51743500 gazaan C March 23, 2019, 6:46 a.m. OK Scala TESTS 65 1450 102195200 1500
51743706 gazaan C March 23, 2019, 6:51 a.m. OK Scala TESTS 65 1497 88268800 1500
51743657 gazaan C March 23, 2019, 6:50 a.m. OK Scala TESTS 65 1512 88268800 1500
51746390 gazaan C March 23, 2019, 7:49 a.m. OK Scala TESTS 65 1544 73830400 1500
51744035 gazaan C March 23, 2019, 6:58 a.m. OK Scala TESTS 65 1980 226508800 1500
51745090 gazaan C March 23, 2019, 7:20 a.m. OK Scala TESTS 65 1981 199680000 1500
51745741 gazaan C March 23, 2019, 7:35 a.m. OK Scala TESTS 65 1996 199680000 1500

remove filters

Back to search problems