Codeforces Round 542 [Alex Lopashev Thanks-Round] (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
1130 Codeforces Round 542 [Alex Lopashev Thanks-Round] (Div. 2) FINISHED False 7200 180800699 Feb. 24, 2019, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7933 ) B Two Cakes PROGRAMMING greedy 1200

B'Sasha and Dima want to buy two n -tier cakes. Each cake should consist of n different tiers: from the size of 1 to the size of n . Tiers should go in order from the smallest to the biggest (from top to bottom). They live on the same street, there are 2 cdot n houses in a row from left to right. Each house has a pastry shop where you can buy a cake tier. Unfortunately, in each pastry shop you can buy only one tier of only one specific size: in the i -th house you can buy a tier of the size a_i ( 1 <= a_i <= n ). Since the guys carry already purchased tiers, and it is impossible to insert a new tier in the middle of the cake, they agreed to buy tiers from the smallest to the biggest. That is, each of them buys tiers in order: 1 , then 2 , then 3 and so on up to n . Initially, Sasha and Dima are located near the first (leftmost) house. Output the minimum distance that they will have to walk in total to buy both cakes. The distance between any two neighboring houses is exactly 1 . The first line of the input contains an integer number n -- the number of tiers in each cake ( 1 <= n <= 10^5 ). The second line contains 2 cdot n integers a_1, a_2, ... , a_{2n} ( 1 <= a_i <= n ), where a_i is equal to the size of the tier, which can be bought in the i -th house. Remember that in each house you can buy only one tier. It is guaranteed that every number from 1 to n occurs in a exactly two times. Print one number -- the minimum distance that the guys have to walk in total to buy both cakes. Guys can be near same house at the same time. They begin near the first (leftmost) house. Each of the guys should buy n tiers in ascending order of their sizes. In the first example, the possible optimal sequence of actions is: So, Sasha goes the distance 3+1=4 , and Dima goes the distance 1+1+3=5 . In total, they cover a distance o'...

Tutorials

65520

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
50584846 Minasenayuki B Feb. 28, 2019, 2:21 a.m. OK Clang++17 Diagnostics TESTS 22 93 921600 1200
58541898 romanporsh B Aug. 10, 2019, 2:38 p.m. OK FPC TESTS 22 46 3584000 1200
50444976 PAG B Feb. 24, 2019, 4:09 p.m. OK FPC TESTS 22 61 819200 1200
51058710 vjudge3 B March 9, 2019, 1:19 a.m. OK FPC TESTS 22 62 8806400 1200
50444514 PhuongPeu B Feb. 24, 2019, 4:07 p.m. OK FPC TESTS 22 62 12083200 1200
51565723 chaorenhaha B March 20, 2019, 9:38 a.m. OK FPC TESTS 22 62 16281600 1200
51058687 luogu_bot4 B March 9, 2019, 1:17 a.m. OK FPC TESTS 22 77 8806400 1200
50446047 TShT B Feb. 24, 2019, 4:13 p.m. OK FPC TESTS 22 78 16179200 1200
50508429 rainboy B Feb. 25, 2019, 9:24 p.m. OK GNU C11 TESTS 22 46 819200 1200
50890048 yang8729 B March 6, 2019, 12:51 p.m. OK GNU C11 TESTS 22 46 819200 1200
50490784 NoSoul B Feb. 25, 2019, 1:14 p.m. OK GNU C11 TESTS 22 46 819200 1200
50445045 alexismed B Feb. 24, 2019, 4:09 p.m. OK GNU C11 TESTS 22 46 819200 1200
50455215 Dynamic. B Feb. 24, 2019, 5:02 p.m. OK GNU C11 TESTS 22 46 819200 1200
50446743 vladislav_k B Feb. 24, 2019, 4:16 p.m. OK GNU C11 TESTS 22 46 819200 1200
50446620 Zimba B Feb. 24, 2019, 4:16 p.m. OK GNU C11 TESTS 22 46 1638400 1200
50466314 Noshin_1703086 B Feb. 24, 2019, 8:02 p.m. OK GNU C11 TESTS 22 46 2457600 1200
50449410 ruhan.habib39 B Feb. 24, 2019, 4:29 p.m. OK GNU C11 TESTS 22 46 3174400 1200
51400305 sayan1706 B March 17, 2019, 6:57 a.m. OK GNU C11 TESTS 22 61 1638400 1200
50585761 Johnson_Wu B Feb. 28, 2019, 3:26 a.m. OK GNU C++11 TESTS 22 30 7987200 1200
50441791 mts_246 B Feb. 24, 2019, 3:57 p.m. OK GNU C++11 TESTS 22 30 24064000 1200
50883524 Onno233 B March 6, 2019, 10:05 a.m. OK GNU C++11 TESTS 22 31 819200 1200
50442997 menjiantong B Feb. 24, 2019, 4:01 p.m. OK GNU C++11 TESTS 22 31 819200 1200
50443310 JKLover B Feb. 24, 2019, 4:02 p.m. OK GNU C++11 TESTS 22 31 819200 1200
50462262 imjching B Feb. 24, 2019, 6:34 p.m. OK GNU C++11 TESTS 22 31 819200 1200
50462620 imjching B Feb. 24, 2019, 6:38 p.m. OK GNU C++11 TESTS 22 31 819200 1200
50471020 dknguyen176 B Feb. 25, 2019, 12:34 a.m. OK GNU C++11 TESTS 22 31 819200 1200
50512600 skk1faker B Feb. 26, 2019, 2:53 a.m. OK GNU C++11 TESTS 22 31 819200 1200
50836510 ChthollyNotaSeniorious B March 5, 2019, 3:37 p.m. OK GNU C++11 TESTS 22 31 921600 1200
53022463 _grvbisht B April 19, 2019, 5:09 p.m. OK GNU C++14 TESTS 22 46 819200 1200
52917423 ..vince B April 17, 2019, 4:24 p.m. OK GNU C++14 TESTS 22 46 819200 1200
50530959 1726tgyeuva B Feb. 26, 2019, 1:37 p.m. OK GNU C++14 TESTS 22 46 819200 1200
50524053 neo11235 B Feb. 26, 2019, 10:55 a.m. OK GNU C++14 TESTS 22 46 819200 1200
50516220 humveea6 B Feb. 26, 2019, 6:36 a.m. OK GNU C++14 TESTS 22 46 819200 1200
50484745 mithun_rahman B Feb. 25, 2019, 11:02 a.m. OK GNU C++14 TESTS 22 46 819200 1200
50477283 Fantastic2009 B Feb. 25, 2019, 6:49 a.m. OK GNU C++14 TESTS 22 46 819200 1200
50468224 Mad_Eye B Feb. 24, 2019, 9:22 p.m. OK GNU C++14 TESTS 22 46 819200 1200
50455059 andrein B Feb. 24, 2019, 5:02 p.m. OK GNU C++14 TESTS 22 46 819200 1200
50446124 fishbowl B Feb. 24, 2019, 4:13 p.m. OK GNU C++14 TESTS 22 46 819200 1200
50473907 fosaken B Feb. 25, 2019, 4:12 a.m. OK GNU C++17 TESTS 22 46 819200 1200
50481944 eu3neuom B Feb. 25, 2019, 9:29 a.m. OK GNU C++17 TESTS 22 46 819200 1200
50522488 TR1CKST3R B Feb. 26, 2019, 10:09 a.m. OK GNU C++17 TESTS 22 46 819200 1200
50535846 ZeroScar B Feb. 26, 2019, 3:39 p.m. OK GNU C++17 TESTS 22 46 819200 1200
50609453 yyzs123 B Feb. 28, 2019, 4:12 p.m. OK GNU C++17 TESTS 22 46 819200 1200
51249165 YureeOh B March 13, 2019, 7:28 a.m. OK GNU C++17 TESTS 22 46 819200 1200
51370952 jonathansilver B March 16, 2019, 11:53 a.m. OK GNU C++17 TESTS 22 46 819200 1200
53219260 wjfwjfwjf B April 24, 2019, 10:56 a.m. OK GNU C++17 TESTS 22 46 819200 1200
61441299 vaaven B Sept. 28, 2019, 6:54 p.m. OK GNU C++17 TESTS 22 46 819200 1200
65452605 kiimak B Nov. 20, 2019, 6:46 p.m. OK GNU C++17 TESTS 22 46 819200 1200
51567135 Lisanaaa B March 20, 2019, 10:11 a.m. OK Go TESTS 22 78 14131200 1200
51567669 Lisanaaa B March 20, 2019, 10:23 a.m. OK Go TESTS 22 93 14131200 1200
51567433 Lisanaaa B March 20, 2019, 10:18 a.m. OK Go TESTS 22 93 14131200 1200
50441893 caidodo0_0 B Feb. 24, 2019, 3:57 p.m. OK Go TESTS 22 171 5222400 1200
50709521 dai B March 3, 2019, 6:09 a.m. OK Go TESTS 22 187 5324800 1200
50464066 torus711 B Feb. 24, 2019, 7 p.m. OK Haskell TESTS 22 342 26419200 1200
50464192 torus711 B Feb. 24, 2019, 7:02 p.m. OK Haskell TESTS 22 358 26316800 1200
50462362 torus711 B Feb. 24, 2019, 6:35 p.m. OK Haskell TESTS 22 358 26419200 1200
50463327 torus711 B Feb. 24, 2019, 6:47 p.m. OK Haskell TESTS 22 374 26316800 1200
50440923 torus711 B Feb. 24, 2019, 3:54 p.m. OK Haskell TESTS 22 405 26316800 1200
50911066 sonowz B March 7, 2019, 2:18 a.m. OK Haskell TESTS 22 685 35840000 1200
50482092 Shivam98 B Feb. 25, 2019, 9:34 a.m. OK Java 8 TESTS 22 109 0 1200
50454093 ExplodingFreeze B Feb. 24, 2019, 4:56 p.m. OK Java 8 TESTS 22 109 0 1200
50452800 darshan287 B Feb. 24, 2019, 4:48 p.m. OK Java 8 TESTS 22 109 0 1200
50441676 rookie19 B Feb. 24, 2019, 3:57 p.m. OK Java 8 TESTS 22 109 0 1200
50440163 baobab B Feb. 24, 2019, 3:52 p.m. OK Java 8 TESTS 22 109 0 1200
51132228 sooraj10 B March 10, 2019, 2:13 p.m. OK Java 8 TESTS 22 124 0 1200
63897050 holeguma B Oct. 31, 2019, 2:45 a.m. OK Java 8 TESTS 22 124 0 1200
63837657 vjudge2 B Oct. 30, 2019, 2:47 p.m. OK Java 8 TESTS 22 124 0 1200
51485083 xodiac B March 19, 2019, 1:13 p.m. OK Java 8 TESTS 22 124 0 1200
50738935 Dhairya472 B March 3, 2019, 2:18 p.m. OK Java 8 TESTS 22 124 0 1200
62609483 Spheniscine B Oct. 15, 2019, 9:10 a.m. OK Kotlin TESTS 22 171 3686400 1200
60185898 rego97 B Sept. 6, 2019, 6:28 p.m. OK Kotlin TESTS 22 327 15872000 1200
50874213 Killer45 B March 6, 2019, 5 a.m. OK Kotlin TESTS 22 436 31436800 1200
55535974 og.kostya B June 13, 2019, 4:25 p.m. OK Mono C# TESTS 22 62 1536000 1200
51339265 danik114162 B March 15, 2019, 3:32 p.m. OK Mono C# TESTS 22 93 14131200 1200
50719665 treasuryonly B March 3, 2019, 8:14 a.m. OK Mono C# TESTS 22 93 14745600 1200
53609014 Xtreemist B May 1, 2019, noon OK Mono C# TESTS 22 93 15360000 1200
50444549 Coder_D B Feb. 24, 2019, 4:07 p.m. OK Mono C# TESTS 22 93 15564800 1200
50459027 mircea85 B Feb. 24, 2019, 5:26 p.m. OK Mono C# TESTS 22 108 13312000 1200
50577686 TRR B Feb. 27, 2019, 7 p.m. OK Mono C# TESTS 22 108 13312000 1200
50444063 muslim B Feb. 24, 2019, 4:05 p.m. OK Mono C# TESTS 22 109 18124800 1200
52465578 vjudge1 B April 7, 2019, 3:29 p.m. OK Mono C# TESTS 22 109 18124800 1200
50440754 omikad B Feb. 24, 2019, 3:54 p.m. OK Mono C# TESTS 22 124 19558400 1200
51417353 vjudge1 B March 17, 2019, 2:42 p.m. OK MS C++ TESTS 22 31 819200 1200
51450546 vjudge5 B March 18, 2019, 2:31 p.m. OK MS C++ TESTS 22 46 819200 1200
51570859 vjudge1 B March 20, 2019, 11:32 a.m. OK MS C++ TESTS 22 46 819200 1200
51488021 vjudge1 B March 19, 2019, 2:25 p.m. OK MS C++ TESTS 22 46 819200 1200
51556150 scorpiowf B March 20, 2019, 5:02 a.m. OK MS C++ TESTS 22 46 1024000 1200
50607102 vjudge2 B Feb. 28, 2019, 3:03 p.m. OK MS C++ TESTS 22 46 1228800 1200
57870925 vjudge5 B July 28, 2019, 1:43 a.m. OK MS C++ TESTS 22 46 1638400 1200
51672548 vjudge3 B March 22, 2019, 8:54 a.m. OK MS C++ TESTS 22 46 1638400 1200
51609636 vjudge5 B March 21, 2019, 9:33 a.m. OK MS C++ TESTS 22 46 1638400 1200
68695004 vjudge3 B Jan. 13, 2020, 7:36 a.m. OK MS C++ TESTS 22 46 2457600 1200
50722393 user2333 B March 3, 2019, 8:44 a.m. OK MS C++ 2017 TESTS 22 61 819200 1200
51355802 beacon_cwk B March 16, 2019, 4:07 a.m. OK MS C++ 2017 TESTS 22 62 819200 1200
57872329 vjudge4 B July 28, 2019, 2:45 a.m. OK MS C++ 2017 TESTS 22 62 1638400 1200
53899718 hwangganzi B May 9, 2019, 8:24 a.m. OK MS C++ 2017 TESTS 22 77 3174400 1200
50447578 hdhh B Feb. 24, 2019, 4:20 p.m. OK MS C++ 2017 TESTS 22 77 3276800 1200
55242514 R99 B June 7, 2019, 11:51 a.m. OK MS C++ 2017 TESTS 22 78 2867200 1200
50443592 GomBu B Feb. 24, 2019, 4:03 p.m. OK MS C++ 2017 TESTS 22 93 4403200 1200
50519458 NotNow B Feb. 26, 2019, 8:35 a.m. OK MS C++ 2017 TESTS 22 140 819200 1200
50446251 jdhanjin B Feb. 24, 2019, 4:14 p.m. OK MS C++ 2017 TESTS 22 140 2457600 1200
50550596 DimaKhovrov B Feb. 27, 2019, 3:47 a.m. OK MS C++ 2017 TESTS 22 155 2457600 1200
50665448 Sirivasv B March 2, 2019, 3:43 a.m. OK Node.js TESTS 22 280 28057600 1200
51206198 sungsupark91 B March 12, 2019, 5:02 a.m. OK Node.js TESTS 22 311 36249600 1200
50537898 Stanislav666 B Feb. 26, 2019, 4:36 p.m. OK PascalABC.NET TESTS 22 327 0 1200
50539134 great_fortune B Feb. 26, 2019, 5:10 p.m. OK PascalABC.NET TESTS 22 327 102400 1200
50539061 great_fortune B Feb. 26, 2019, 5:08 p.m. OK PascalABC.NET TESTS 22 342 2150400 1200
50446800 l-_-l B Feb. 24, 2019, 4:16 p.m. OK PascalABC.NET TESTS 22 436 4608000 1200
50478039 gmusya B Feb. 25, 2019, 7:15 a.m. OK PascalABC.NET TESTS 22 482 8294400 1200
50480622 mayakin B Feb. 25, 2019, 8:47 a.m. OK PHP TESTS 22 155 26931200 1200
50458865 Mukundan314 B Feb. 24, 2019, 5:25 p.m. OK PyPy 2 TESTS 22 202 14540800 1200
51464255 vjudge1 B March 18, 2019, 10:48 p.m. OK PyPy 2 TESTS 22 217 14233600 1200
50441445 codeseeker B Feb. 24, 2019, 3:56 p.m. OK PyPy 2 TESTS 22 217 15462400 1200
50510172 ilkerkosaroglu B Feb. 25, 2019, 11:10 p.m. OK PyPy 2 TESTS 22 233 14745600 1200
50441471 cherry_su B Feb. 24, 2019, 3:56 p.m. OK PyPy 2 TESTS 22 233 14848000 1200
50442021 zacker-22 B Feb. 24, 2019, 3:58 p.m. OK PyPy 2 TESTS 22 280 19865600 1200
50440032 gatsko B Feb. 24, 2019, 3:52 p.m. OK PyPy 2 TESTS 22 311 22118400 1200
50492544 YESMAths B Feb. 25, 2019, 1:52 p.m. OK PyPy 2 TESTS 22 358 27033600 1200
50503988 chaorrupted B Feb. 25, 2019, 6:38 p.m. OK PyPy 2 TESTS 22 685 14028800 1200
50440936 c1729 B Feb. 24, 2019, 3:54 p.m. OK PyPy 2 TESTS 22 717 16281600 1200
50443967 sm1ley B Feb. 24, 2019, 4:05 p.m. OK PyPy 3 TESTS 22 233 16691200 1200
50443590 agarus B Feb. 24, 2019, 4:03 p.m. OK PyPy 3 TESTS 22 233 16691200 1200
50442890 Tarik02 B Feb. 24, 2019, 4:01 p.m. OK PyPy 3 TESTS 22 249 18432000 1200
50904524 shaswat57 B March 6, 2019, 7:10 p.m. OK PyPy 3 TESTS 22 264 20070400 1200
50448117 SHOVON588 B Feb. 24, 2019, 4:23 p.m. OK PyPy 3 TESTS 22 265 16793600 1200
50502535 myway_82 B Feb. 25, 2019, 5:56 p.m. OK PyPy 3 TESTS 22 280 19353600 1200
50696274 Hokage777 B March 2, 2019, 6:18 p.m. OK PyPy 3 TESTS 22 280 20480000 1200
50670904 mug B March 2, 2019, 6:55 a.m. OK PyPy 3 TESTS 22 280 22016000 1200
50495267 hrustim25 B Feb. 25, 2019, 2:54 p.m. OK PyPy 3 TESTS 22 280 23040000 1200
53001387 SarveshDubey B April 19, 2019, 7:17 a.m. OK PyPy 3 TESTS 22 295 21606400 1200
50454262 elistark B Feb. 24, 2019, 4:57 p.m. OK Python 2 TESTS 22 342 11059200 1200
51512914 jooj B March 19, 2019, 3:33 p.m. OK Python 2 TESTS 22 358 13926400 1200
51513454 jooj B March 19, 2019, 3:34 p.m. OK Python 2 TESTS 22 374 13926400 1200
51514165 vjudge2 B March 19, 2019, 3:36 p.m. OK Python 2 TESTS 22 389 13824000 1200
50441560 arman.t B Feb. 24, 2019, 3:56 p.m. OK Python 2 TESTS 22 389 14438400 1200
50510672 nealzane B Feb. 25, 2019, 11:57 p.m. OK Python 2 TESTS 22 405 16896000 1200
50473065 pri71194 B Feb. 25, 2019, 3:17 a.m. OK Python 2 TESTS 22 452 20172800 1200
51774491 jrobsonjr B March 23, 2019, 8:32 p.m. OK Python 2 TESTS 22 483 17305600 1200
50443152 sampsonguo302 B Feb. 24, 2019, 4:02 p.m. OK Python 2 TESTS 22 483 17305600 1200
50667602 bhuwanchandra.it B March 2, 2019, 5:14 a.m. OK Python 2 TESTS 22 483 17612800 1200
50442023 htkb B Feb. 24, 2019, 3:58 p.m. OK Python 3 TESTS 22 280 14131200 1200
51081395 the_white_devil B March 9, 2019, 11:26 a.m. OK Python 3 TESTS 22 280 14745600 1200
50449280 raj1307 B Feb. 24, 2019, 4:29 p.m. OK Python 3 TESTS 22 280 18636800 1200
55588589 smir2k14 B June 15, 2019, 11:02 a.m. OK Python 3 TESTS 22 295 14848000 1200
55475159 Parag_AP B June 11, 2019, 10:22 p.m. OK Python 3 TESTS 22 295 14848000 1200
50523242 Sarilanoo B Feb. 26, 2019, 10:31 a.m. OK Python 3 TESTS 22 311 14131200 1200
50473921 nikeshthapa255 B Feb. 25, 2019, 4:13 a.m. OK Python 3 TESTS 22 311 14540800 1200
50640019 lucad B March 1, 2019, 1:32 p.m. OK Python 3 TESTS 22 311 16486400 1200
50540612 Garan B Feb. 26, 2019, 5:54 p.m. OK Python 3 TESTS 22 311 16588800 1200
50564742 fatemehGhasemi B Feb. 27, 2019, 12:40 p.m. OK Python 3 TESTS 22 312 14131200 1200
50448606 trishume B Feb. 24, 2019, 4:25 p.m. OK Ruby TESTS 22 312 56934400 1200
50447799 arzk B Feb. 24, 2019, 4:21 p.m. OK Rust TESTS 22 202 9113600 1200
51415303 yakamoto B March 17, 2019, 1:44 p.m. OK Scala TESTS 22 420 0 1200
50448292 nafeezabrar B Feb. 24, 2019, 4:24 p.m. OK Scala TESTS 22 716 15052800 1200

remove filters

Back to search problems