Codeforces Round 507 (Div. 2, based on Olympiad of Metropolises)

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
1040 Codeforces Round 507 (Div. 2, based on Olympiad of Metropolises) FINISHED False 7200 201360323 Sept. 5, 2018, 4:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 9667 ) A Palindrome Dance PROGRAMMING greedy 1000

B"A group of n dancers rehearses a performance for the closing ceremony. The dancers are arranged in a row, they've studied their dancing moves and can't change positions. For some of them, a white dancing suit is already bought, for some of them -- a black one, and for the rest the suit will be bought in the future. On the day when the suits were to be bought, the director was told that the participants of the olympiad will be happy if the colors of the suits on the scene will form a palindrome. A palindrome is a sequence that is the same when read from left to right and when read from right to left. The director liked the idea, and she wants to buy suits so that the color of the leftmost dancer's suit is the same as the color of the rightmost dancer's suit, the 2nd left is the same as 2nd right, and so on. The director knows how many burls it costs to buy a white suit, and how many burls to buy a black suit. You need to find out whether it is possible to buy suits to form a palindrome, and if it's possible, what's the minimal cost of doing so. Remember that dancers can not change positions, and due to bureaucratic reasons it is not allowed to buy new suits for the dancers who already have suits, even if it reduces the overall spending. The first line contains three integers n , a , and b ( 1 <= q n <= q 20 , 1 <= q a, b <= q 100 ) -- the number of dancers, the cost of a white suit, and the cost of a black suit. The next line contains n numbers c_i , i -th of which denotes the color of the suit of the i -th dancer. Number 0 denotes the white color, 1 -- the black color, and 2 denotes that a suit for this dancer is still to be bought. If it is not possible to form a palindrome without swapping dancers and buying new suits for those who have one, then output -1. Otherwise, output the minimal price to get the desired visual effect. In the first sample, the cheapest way to obtain palindr"...

Tutorials

Codeforces Round #507 (based on Olympiad of Metropolises) — Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
42685352 Rimon_1703126 A Sept. 8, 2018, 7:01 p.m. OK Clang++17 Diagnostics TESTS 53 46 0 1000
43373796 DevilInChina A Sept. 24, 2018, 3:42 p.m. OK Clang++17 Diagnostics TESTS 53 46 0 1000
42843177 Oxintes A Sept. 13, 2018, 8:12 p.m. OK Clang++17 Diagnostics TESTS 53 46 0 1000
42866993 kamesan A Sept. 14, 2018, 4:19 p.m. OK Clang++17 Diagnostics TESTS 53 46 0 1000
42692549 Mohamed.Hussein98 A Sept. 9, 2018, 3:26 a.m. OK Clang++17 Diagnostics TESTS 53 46 204800 1000
42536388 ytj2 A Sept. 6, 2018, 1:57 a.m. OK Clang++17 Diagnostics TESTS 53 46 1126400 1000
43047703 mintcrystaal A Sept. 18, 2018, 7:02 p.m. OK Clang++17 Diagnostics TESTS 53 93 86732800 1000
42505918 pchvirov A Sept. 5, 2018, 5 p.m. OK Delphi TESTS 53 31 102400 1000
42533877 ruban A Sept. 5, 2018, 11:05 p.m. OK Delphi TESTS 53 31 21606400 1000
42514737 kostia1359 A Sept. 5, 2018, 5:37 p.m. OK FPC TESTS 53 31 0 1000
42767449 Brainett A Sept. 11, 2018, 1:51 p.m. OK FPC TESTS 53 31 0 1000
42594387 MrCriss1 A Sept. 6, 2018, 9:56 p.m. OK FPC TESTS 53 31 0 1000
42591547 TShT A Sept. 6, 2018, 8:06 p.m. OK FPC TESTS 53 31 0 1000
42576494 AFH A Sept. 6, 2018, 4:31 p.m. OK FPC TESTS 53 31 0 1000
42567837 Bear.-. A Sept. 6, 2018, 3:59 p.m. OK FPC TESTS 53 31 0 1000
42547650 1Demiurg A Sept. 6, 2018, 10:04 a.m. OK FPC TESTS 53 31 0 1000
42543932 DEFAQ A Sept. 6, 2018, 7:54 a.m. OK FPC TESTS 53 31 0 1000
42543244 Ivanek333 A Sept. 6, 2018, 7:29 a.m. OK FPC TESTS 53 31 0 1000
42539473 BlueSky01 A Sept. 6, 2018, 4:49 a.m. OK FPC TESTS 53 31 0 1000
42533695 STG005 A Sept. 5, 2018, 10:53 p.m. OK GNU C11 TESTS 53 30 0 1000
53743736 tieulac305 A May 4, 2019, 3:21 p.m. OK GNU C11 TESTS 53 31 0 1000
54403065 acid_m A May 20, 2019, 3:12 a.m. OK GNU C11 TESTS 53 31 0 1000
56989496 You_Know_Who A July 13, 2019, 5:27 p.m. OK GNU C11 TESTS 53 31 0 1000
61023865 vjudge4 A Sept. 21, 2019, 3:24 p.m. OK GNU C11 TESTS 53 31 0 1000
61288768 timam_saif A Sept. 25, 2019, 7:35 p.m. OK GNU C11 TESTS 53 31 0 1000
62584359 DevJewel A Oct. 14, 2019, 6:16 p.m. OK GNU C11 TESTS 53 31 0 1000
63530489 Balkrushna1 A Oct. 27, 2019, 6:34 a.m. OK GNU C11 TESTS 53 31 0 1000
65881355 torque_459 A Nov. 27, 2019, 7:11 p.m. OK GNU C11 TESTS 53 31 0 1000
67044350 raresmihai01 A Dec. 16, 2019, 8:58 p.m. OK GNU C11 TESTS 53 31 0 1000
42549428 WhiteFantasy A Sept. 6, 2018, 11:11 a.m. OK GNU C++11 TESTS 53 30 0 1000
42549687 BestMSN A Sept. 6, 2018, 11:19 a.m. OK GNU C++11 TESTS 53 30 0 1000
42557837 vjudge4 A Sept. 6, 2018, 3:03 p.m. OK GNU C++11 TESTS 53 30 0 1000
43081820 sayd17 A Sept. 19, 2018, 2:12 p.m. OK GNU C++11 TESTS 53 30 0 1000
43265302 ajaychavda A Sept. 22, 2018, 4:12 p.m. OK GNU C++11 TESTS 53 30 0 1000
44282042 machine_gun A Oct. 14, 2018, 5:27 a.m. OK GNU C++11 TESTS 53 30 0 1000
44660784 roman.rylko A Oct. 21, 2018, 3:05 p.m. OK GNU C++11 TESTS 53 30 0 1000
45506055 NikonD850 A Nov. 10, 2018, 10:35 a.m. OK GNU C++11 TESTS 53 30 0 1000
49108348 thienchidh A Jan. 28, 2019, 1:59 p.m. OK GNU C++11 TESTS 53 30 0 1000
49131833 luogu_bot1 A Jan. 29, 2019, 4:59 a.m. OK GNU C++11 TESTS 53 30 0 1000
42680404 Enneagon A Sept. 8, 2018, 4:04 p.m. OK GNU C++14 TESTS 53 15 0 1000
54911167 tyrant_2 A June 1, 2019, 11:16 a.m. OK GNU C++14 TESTS 53 15 0 1000
52343238 Learnerxy A April 5, 2019, 11:29 a.m. OK GNU C++14 TESTS 53 15 0 1000
43507970 skyscraper A Sept. 27, 2018, 8:32 p.m. OK GNU C++14 TESTS 53 15 0 1000
43493039 Yuki726 A Sept. 27, 2018, 1:27 p.m. OK GNU C++14 TESTS 53 15 0 1000
42769061 navneet.h A Sept. 11, 2018, 2:34 p.m. OK GNU C++14 TESTS 53 15 0 1000
42686252 nivaan A Sept. 8, 2018, 7:39 p.m. OK GNU C++14 TESTS 53 15 0 1000
42539573 burhan103335 A Sept. 6, 2018, 4:55 a.m. OK GNU C++14 TESTS 53 15 0 1000
42539275 master_vil A Sept. 6, 2018, 4:37 a.m. OK GNU C++14 TESTS 53 15 0 1000
42529679 Vishal_Kumar9 A Sept. 5, 2018, 8:14 p.m. OK GNU C++14 TESTS 53 15 0 1000
58546566 _baba_yaga A Aug. 10, 2019, 5:02 p.m. OK GNU C++17 TESTS 53 15 0 1000
52577700 georgeoctavian A April 10, 2019, 5:15 p.m. OK GNU C++17 TESTS 53 15 0 1000
54022338 Roniee1612 A May 12, 2019, 10:32 a.m. OK GNU C++17 TESTS 53 15 0 1000
69079109 Falcon__ A Jan. 19, 2020, 5:28 a.m. OK GNU C++17 TESTS 53 15 0 1000
42741761 mtropets A Sept. 10, 2018, 4:43 p.m. OK GNU C++17 TESTS 53 15 0 1000
52064756 vjudge2 A March 31, 2019, 4:34 a.m. OK GNU C++17 TESTS 53 15 0 1000
42506851 Jaki A Sept. 5, 2018, 5:03 p.m. OK GNU C++17 TESTS 53 15 204800 1000
42517154 KING-SEN A Sept. 5, 2018, 5:48 p.m. OK GNU C++17 TESTS 53 15 204800 1000
42698756 niki.c2014 A Sept. 9, 2018, 9:08 a.m. OK GNU C++17 TESTS 53 15 204800 1000
44769954 woaimeishi A Oct. 24, 2018, 11:53 a.m. OK GNU C++17 TESTS 53 15 307200 1000
45693754 Wapi A Nov. 13, 2018, 11:31 p.m. OK Go TESTS 53 31 0 1000
42502562 kamranm A Sept. 5, 2018, 4:47 p.m. OK Go TESTS 53 31 204800 1000
42735222 cacophonix A Sept. 10, 2018, 1:31 p.m. OK Go TESTS 53 31 307200 1000
42506565 upvas A Sept. 5, 2018, 5:02 p.m. OK Go TESTS 53 31 2048000 1000
46724337 jedikni A Dec. 7, 2018, 2:21 p.m. OK Haskell TESTS 53 15 8499200 1000
45153877 peter_jerry_ye A Oct. 31, 2018, 10:27 p.m. OK Haskell TESTS 53 46 8499200 1000
46839883 afrizal ibrohimislam antonfireball A Dec. 10, 2018, 6:41 a.m. OK Java 8 TESTS 53 108 0 1000
68730280 recs.cse1632 A Jan. 13, 2020, 7:45 p.m. OK Java 8 TESTS 53 109 0 1000
58528291 vivek_23 A Aug. 10, 2019, 8:14 a.m. OK Java 8 TESTS 53 109 0 1000
55675558 Bashar. A June 17, 2019, 10:12 a.m. OK Java 8 TESTS 53 109 0 1000
55599624 YousseF_Diaa A June 15, 2019, 5:23 p.m. OK Java 8 TESTS 53 109 0 1000
54521344 mufaddalnaya A May 23, 2019, 12:24 p.m. OK Java 8 TESTS 53 109 0 1000
52317621 vishwajeetk653 A April 4, 2019, 5:55 p.m. OK Java 8 TESTS 53 109 0 1000
51754944 kissscreen A March 23, 2019, 11:10 a.m. OK Java 8 TESTS 53 109 0 1000
50334344 SITTm A Feb. 22, 2019, 8:02 p.m. OK Java 8 TESTS 53 109 0 1000
49585162 vjudge3 A Feb. 7, 2019, 2:40 p.m. OK Java 8 TESTS 53 109 0 1000
42746457 Filon A Sept. 10, 2018, 7:39 p.m. OK JavaScript TESTS 53 31 0 1000
42544677 bomlalung A Sept. 6, 2018, 8:20 a.m. OK JavaScript TESTS 53 31 0 1000
42543075 NguyenHungCuong A Sept. 6, 2018, 7:22 a.m. OK JavaScript TESTS 53 31 0 1000
42866277 sayeh A Sept. 14, 2018, 3:52 p.m. OK JavaScript TESTS 53 46 0 1000
42782002 bdomokos A Sept. 11, 2018, 10:24 p.m. OK JavaScript TESTS 53 46 0 1000
45106215 hast_ A Oct. 30, 2018, 4:17 p.m. OK Kotlin TESTS 53 155 614400 1000
42517807 erenerisken A Sept. 5, 2018, 5:52 p.m. OK Kotlin TESTS 53 171 614400 1000
42508773 camoroh13 A Sept. 5, 2018, 5:11 p.m. OK Kotlin TESTS 53 171 614400 1000
42513805 Bobko A Sept. 5, 2018, 5:32 p.m. OK Kotlin TESTS 53 186 614400 1000
42761350 kihen A Sept. 11, 2018, 10:50 a.m. OK Kotlin TESTS 53 186 1740800 1000
43128911 gg89 A Sept. 20, 2018, 3:20 p.m. OK Kotlin TESTS 53 202 0 1000
47715032 tarptaeya A Dec. 30, 2018, 7 a.m. OK Mono C# TESTS 53 46 0 1000
42512286 sid0adams A Sept. 5, 2018, 5:26 p.m. OK Mono C# TESTS 53 46 0 1000
42515238 Billiam A Sept. 5, 2018, 5:39 p.m. OK Mono C# TESTS 53 46 0 1000
42676698 TrinidadTobago A Sept. 8, 2018, 2:04 p.m. OK Mono C# TESTS 53 46 0 1000
42873243 lehapenza A Sept. 14, 2018, 8:44 p.m. OK Mono C# TESTS 53 46 0 1000
42903995 itaka A Sept. 15, 2018, 9:53 p.m. OK Mono C# TESTS 53 46 0 1000
43038101 n.a.borisov A Sept. 18, 2018, 2:26 p.m. OK Mono C# TESTS 53 46 0 1000
54864724 og.kostya A May 31, 2019, 5:22 a.m. OK Mono C# TESTS 53 46 102400 1000
42729274 HarryPotniy A Sept. 10, 2018, 10:21 a.m. OK Mono C# TESTS 53 61 3584000 1000
42853046 MedGeek A Sept. 14, 2018, 7:14 a.m. OK Mono C# TESTS 53 62 0 1000
42874328 vjudge3 A Sept. 14, 2018, 9:54 p.m. OK MS C++ TESTS 53 15 307200 1000
46195570 vjudge3 A Nov. 25, 2018, 8:07 a.m. OK MS C++ TESTS 53 30 0 1000
42502781 MagicaQuartet A Sept. 5, 2018, 4:48 p.m. OK MS C++ TESTS 53 30 204800 1000
42501673 SevagD A Sept. 5, 2018, 4:45 p.m. OK MS C++ TESTS 53 30 307200 1000
51034081 vjudge3 A March 8, 2019, 2:22 p.m. OK MS C++ TESTS 53 31 0 1000
51030010 vjudge4 A March 8, 2019, 1:22 p.m. OK MS C++ TESTS 53 31 0 1000
50927383 vjudge3 A March 7, 2019, 12:29 p.m. OK MS C++ TESTS 53 31 0 1000
52529362 vjudge3 A April 9, 2019, 12:52 p.m. OK MS C++ TESTS 53 31 0 1000
52778044 vjudge5 A April 15, 2019, 12:54 p.m. OK MS C++ TESTS 53 31 0 1000
58538294 vjudge5 A Aug. 10, 2019, 12:56 p.m. OK MS C++ TESTS 53 31 0 1000
61253796 parisa.mqdm A Sept. 25, 2019, 9:18 a.m. OK MS C++ 2017 TESTS 53 31 0 1000
53291590 tdlbw Sasha0738 A April 25, 2019, 3:53 p.m. OK MS C++ 2017 TESTS 53 31 0 1000
53291648 Stivion Mucaltinum A April 25, 2019, 3:54 p.m. OK MS C++ 2017 TESTS 53 31 0 1000
52484829 lechinhin A April 8, 2019, 8:18 a.m. OK MS C++ 2017 TESTS 53 31 0 1000
55256805 Mad112233 A June 7, 2019, 12:54 p.m. OK MS C++ 2017 TESTS 53 31 0 1000
57058139 Moen1578 A July 14, 2019, 4:55 p.m. OK MS C++ 2017 TESTS 53 31 0 1000
57058832 Moen1578 A July 14, 2019, 5:05 p.m. OK MS C++ 2017 TESTS 53 31 0 1000
42503424 Guramidev A Sept. 5, 2018, 4:50 p.m. OK Node.js TESTS 53 202 204800 1000
42503821 sk0 A Sept. 5, 2018, 4:51 p.m. OK Ocaml TESTS 53 31 0 1000
42893269 Dr_Kotjara A Sept. 15, 2018, 2:04 p.m. OK PascalABC.NET TESTS 53 31 0 1000
42502879 l-_-l A Sept. 5, 2018, 4:48 p.m. OK PascalABC.NET TESTS 53 46 0 1000
44225353 Arkanec A Oct. 12, 2018, 7:12 p.m. OK PascalABC.NET TESTS 53 46 0 1000
42767426 Brainett A Sept. 11, 2018, 1:51 p.m. OK PascalABC.NET TESTS 53 46 0 1000
42507082 ElIlia A Sept. 5, 2018, 5:04 p.m. OK PascalABC.NET TESTS 53 46 0 1000
42543468 OpKos A Sept. 6, 2018, 7:37 a.m. OK PascalABC.NET TESTS 53 46 204800 1000
42503651 rfhfnbcn01 A Sept. 5, 2018, 4:51 p.m. OK PascalABC.NET TESTS 53 46 204800 1000
42741816 FunkyFrog A Sept. 10, 2018, 4:45 p.m. OK PascalABC.NET TESTS 53 61 0 1000
56543357 Gimber A July 5, 2019, 6:28 a.m. OK PascalABC.NET TESTS 53 202 0 1000
42903089 s_p A Sept. 15, 2018, 8:45 p.m. OK Perl TESTS 53 31 0 1000
42531198 rsFalse A Sept. 5, 2018, 8:54 p.m. OK Perl TESTS 53 31 0 1000
42530836 rsFalse A Sept. 5, 2018, 8:45 p.m. OK Perl TESTS 53 31 0 1000
42530275 rsFalse A Sept. 5, 2018, 8:28 p.m. OK Perl TESTS 53 31 0 1000
42501924 rsFalse A Sept. 5, 2018, 4:45 p.m. OK Perl TESTS 53 46 0 1000
43083611 mayakin A Sept. 19, 2018, 3 p.m. OK PHP TESTS 53 31 409600 1000
50321113 YESMAths A Feb. 22, 2019, 2:35 p.m. OK PyPy 2 TESTS 53 124 0 1000
43650074 soumyasarkar1998 A Oct. 1, 2018, 3:20 p.m. OK PyPy 2 TESTS 53 124 0 1000
42522005 samriti A Sept. 5, 2018, 6:13 p.m. OK PyPy 2 TESTS 53 140 0 1000
42696566 apoorv1999 A Sept. 9, 2018, 7:36 a.m. OK PyPy 2 TESTS 53 140 0 1000
42651340 nealzane A Sept. 7, 2018, 6:40 p.m. OK PyPy 2 TESTS 53 140 0 1000
42531508 pa.n.ik A Sept. 5, 2018, 9:02 p.m. OK PyPy 2 TESTS 53 140 0 1000
42518755 aniket11 A Sept. 5, 2018, 5:56 p.m. OK PyPy 2 TESTS 53 140 0 1000
42502973 gilou A Sept. 5, 2018, 4:48 p.m. OK PyPy 2 TESTS 53 140 0 1000
42500826 rkstalker A Sept. 5, 2018, 4:42 p.m. OK PyPy 2 TESTS 53 140 0 1000
42500506 sarthakmanna A Sept. 5, 2018, 4:41 p.m. OK PyPy 2 TESTS 53 140 0 1000
49675232 abdolsamad A Feb. 9, 2019, 7:18 p.m. OK PyPy 3 TESTS 53 124 0 1000
44619136 omarnvidia A Oct. 21, 2018, 5:01 a.m. OK PyPy 3 TESTS 53 124 0 1000
55844784 tchr A June 20, 2019, 8:25 p.m. OK PyPy 3 TESTS 53 139 0 1000
53106335 cykel A April 21, 2019, 8:19 p.m. OK PyPy 3 TESTS 53 139 0 1000
45265414 bergus A Nov. 4, 2018, 5:34 a.m. OK PyPy 3 TESTS 53 139 0 1000
42715878 wadissimo A Sept. 9, 2018, 7:08 p.m. OK PyPy 3 TESTS 53 139 0 1000
49288015 M1T A Jan. 31, 2019, 6:21 p.m. OK PyPy 3 TESTS 53 139 21401600 1000
62261938 Driver12 A Oct. 10, 2019, 12:29 p.m. OK PyPy 3 TESTS 53 140 0 1000
58390076 jvti A Aug. 6, 2019, 1:23 p.m. OK PyPy 3 TESTS 53 140 0 1000
58242175 vjudge3 A Aug. 4, 2019, 2:14 a.m. OK PyPy 3 TESTS 53 140 0 1000
44440574 mukeremali A Oct. 17, 2018, 11:56 a.m. OK Python 2 TESTS 53 171 0 1000
42874504 vjudge2 A Sept. 14, 2018, 10:06 p.m. OK Python 2 TESTS 53 171 0 1000
42617508 mihiru A Sept. 7, 2018, 2:31 p.m. OK Python 2 TESTS 53 171 0 1000
42538613 Butane A Sept. 6, 2018, 4:01 a.m. OK Python 2 TESTS 53 171 0 1000
42532998 Carlson.Bimbuh A Sept. 5, 2018, 10:04 p.m. OK Python 2 TESTS 53 171 0 1000
42529683 mrcmrcmrc A Sept. 5, 2018, 8:14 p.m. OK Python 2 TESTS 53 171 0 1000
43577236 SerChirag A Sept. 29, 2018, 3:32 p.m. OK Python 2 TESTS 53 186 0 1000
43018564 samardeepdas2013 A Sept. 18, 2018, 2:16 a.m. OK Python 2 TESTS 53 186 0 1000
42874351 vjudge5 A Sept. 14, 2018, 9:56 p.m. OK Python 2 TESTS 53 186 0 1000
42854754 mathturbator A Sept. 14, 2018, 8:33 a.m. OK Python 2 TESTS 53 186 0 1000
58389709 jvti A Aug. 6, 2019, 1:15 p.m. OK Python 3 TESTS 53 109 0 1000
58292448 vjudge4 A Aug. 4, 2019, 5:41 p.m. OK Python 3 TESTS 53 109 0 1000
58042048 vjudge2 A July 30, 2019, 8:11 p.m. OK Python 3 TESTS 53 109 0 1000
54700125 vulcanx21 A May 26, 2019, 10:16 p.m. OK Python 3 TESTS 53 109 0 1000
53563144 vjudge4 A April 30, 2019, 10:53 a.m. OK Python 3 TESTS 53 109 0 1000
53537507 vjudge2 A April 30, 2019, 3:49 a.m. OK Python 3 TESTS 53 109 0 1000
53537305 vjudge3 A April 30, 2019, 3:38 a.m. OK Python 3 TESTS 53 109 0 1000
52342685 pragya_2 A April 5, 2019, 11:16 a.m. OK Python 3 TESTS 53 109 0 1000
51473916 Mehrdad_ravenS A March 19, 2019, 8:17 a.m. OK Python 3 TESTS 53 109 0 1000
50876930 ygape1s A March 6, 2019, 6:49 a.m. OK Python 3 TESTS 53 109 0 1000
42544342 duanhv A Sept. 6, 2018, 8:07 a.m. OK Ruby TESTS 53 62 0 1000
42524021 shivamjain A Sept. 5, 2018, 6:23 p.m. OK Ruby TESTS 53 77 0 1000
42501984 AnandVeeramani A Sept. 5, 2018, 4:46 p.m. OK Ruby TESTS 53 77 204800 1000
42508930 clrcldy A Sept. 5, 2018, 5:12 p.m. OK Rust TESTS 53 31 0 1000
42504458 yakamoto A Sept. 5, 2018, 4:54 p.m. OK Scala TESTS 53 545 102400 1000
42555027 DrFaust A Sept. 6, 2018, 1:47 p.m. OK Scala TESTS 53 545 716800 1000

remove filters

Back to search problems