Codeforces Round 492 (Div. 1) [Thanks, uDebug!]

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
995 Codeforces Round 492 (Div. 1) [Thanks, uDebug!] FINISHED False 7200 201965099 June 24, 2018, 4:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7110 ) B Suit and Tie PROGRAMMING greedy implementation math 1500

B"Allen is hosting a formal dinner party. 2n people come to the event in n pairs (couples). After a night of fun, Allen wants to line everyone up for a final picture. The 2n people line up, but Allen doesn't like the ordering. Allen prefers if each pair occupies adjacent positions in the line, as this makes the picture more aesthetic. Help Allen find the minimum number of swaps of adjacent positions he must perform to make it so that each couple occupies adjacent positions in the line. The first line contains a single integer n ( 1 <= n <= 100 ), the number of pairs of people. The second line contains 2n integers a_1, a_2, ... , a_{2n} . For each i with 1 <= i <= n , i appears exactly twice. If a_j = a_k = i , that means that the j -th and k -th people in the line form a couple. Output a single integer, representing the minimum number of adjacent swaps needed to line the people up so that each pair occupies adjacent positions. In the first sample case, we can transform 1 1 2 3 3 2 4 4 rightarrow 1 1 2 3 2 3 4 4 rightarrow 1 1 2 2 3 3 4 4 in two steps. Note that the sequence 1 1 2 3 3 2 4 4 rightarrow 1 1 3 2 3 2 4 4 rightarrow 1 1 3 3 2 2 4 4 also works in the same number of steps. The second sample case already satisfies the constraints; therefore we need 0 swaps. "...

Tutorials

Editorial for Codeforces Round #492 [Thanks u-Debug!]

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
39611286 Gassa B June 24, 2018, 4:43 p.m. OK D TESTS 22 31 0 1500
69501463 hos.lyric B Jan. 25, 2020, 6:44 a.m. OK D TESTS 22 31 0 1500
39642209 _Time_Lord_ B June 25, 2018, 7:47 a.m. OK FPC TESTS 22 15 0 1500
39612726 matipau B June 24, 2018, 4:49 p.m. OK GNU C TESTS 22 15 0 1500
39849476 Udders B July 1, 2018, 7:23 p.m. OK GNU C TESTS 22 31 0 1500
39726696 aadesh.gujjar25 B June 27, 2018, 7:59 p.m. OK GNU C TESTS 22 31 0 1500
40207700 TsReaper B July 11, 2018, 4:43 p.m. OK GNU C TESTS 22 31 0 1500
41101490 vjudge4 B Aug. 2, 2018, 1:18 a.m. OK GNU C++ TESTS 22 15 0 1500
39615481 fleimgruber B June 24, 2018, 5:01 p.m. OK GNU C++ TESTS 22 15 0 1500
41336000 vjudge4 B Aug. 8, 2018, 12:06 p.m. OK GNU C++ TESTS 22 15 0 1500
39785769 GrandMasterdan B June 30, 2018, 2:13 a.m. OK GNU C++ TESTS 22 15 0 1500
39721410 rajatmohan B June 27, 2018, 4:34 p.m. OK GNU C++ TESTS 22 15 0 1500
39689977 ccosi B June 27, 2018, 3:26 a.m. OK GNU C++ TESTS 22 15 0 1500
39658911 Suraj1667 B June 25, 2018, 7:36 p.m. OK GNU C++ TESTS 22 15 0 1500
39641282 Dracarys99 B June 25, 2018, 7:13 a.m. OK GNU C++ TESTS 22 15 0 1500
39637244 piyushkumarmaurya B June 25, 2018, 3:45 a.m. OK GNU C++ TESTS 22 15 0 1500
39620673 fpdqwq B June 24, 2018, 5:33 p.m. OK GNU C++ TESTS 22 15 0 1500
39675664 pakili B June 26, 2018, 12:40 p.m. OK GNU C11 TESTS 22 15 0 1500
57503816 vjudge4 B July 22, 2019, 11:18 a.m. OK GNU C11 TESTS 22 31 0 1500
51412899 varun4796 B March 17, 2019, 12:48 p.m. OK GNU C11 TESTS 22 31 0 1500
43360121 TOKYO_03 B Sept. 24, 2018, 8:47 a.m. OK GNU C11 TESTS 22 31 307200 1500
39792213 quang13542 B June 30, 2018, 8:43 a.m. OK GNU C++11 TESTS 22 15 0 1500
39756092 miaowey B June 29, 2018, 2:07 a.m. OK GNU C++11 TESTS 22 15 0 1500
39729844 RNS_MHB B June 28, 2018, 12:33 a.m. OK GNU C++11 TESTS 22 15 0 1500
39700431 v.haralampiev B June 27, 2018, 11:53 a.m. OK GNU C++11 TESTS 22 15 0 1500
39699132 oleg_b B June 27, 2018, 10:57 a.m. OK GNU C++11 TESTS 22 15 0 1500
39697302 WhiteFantasy B June 27, 2018, 9:38 a.m. OK GNU C++11 TESTS 22 15 0 1500
42412101 samulokito14 B Sept. 3, 2018, 2:31 a.m. OK GNU C++11 TESTS 22 15 0 1500
43075357 Vilespine_Slayer B Sept. 19, 2018, 11:31 a.m. OK GNU C++11 TESTS 22 15 0 1500
47314217 MiEcoku B Dec. 21, 2018, 12:18 a.m. OK GNU C++11 TESTS 22 15 0 1500
57869452 lopare B July 28, 2019, 12:19 a.m. OK GNU C++11 TESTS 22 15 0 1500
55939954 gokul.raj B June 22, 2019, 4:02 p.m. OK GNU C++14 TESTS 22 15 0 1500
65514185 Tanvir_Rasel B Nov. 22, 2019, 6 a.m. OK GNU C++14 TESTS 22 15 0 1500
65509007 Lazy-Tortoise B Nov. 22, 2019, 2:03 a.m. OK GNU C++14 TESTS 22 15 0 1500
65426343 IordachescuAnca B Nov. 20, 2019, 10:48 a.m. OK GNU C++14 TESTS 22 15 0 1500
63933628 worldhello1604 B Oct. 31, 2019, 3:01 p.m. OK GNU C++14 TESTS 22 15 0 1500
58985691 Nova B Aug. 18, 2019, 6:57 a.m. OK GNU C++14 TESTS 22 15 0 1500
58394217 yonkoaman B Aug. 6, 2019, 2:55 p.m. OK GNU C++14 TESTS 22 15 0 1500
58383491 Amaryllis B Aug. 6, 2019, 10:59 a.m. OK GNU C++14 TESTS 22 15 0 1500
57632223 nks43 B July 24, 2019, 9:09 a.m. OK GNU C++14 TESTS 22 15 0 1500
56162120 amitm16a2 B June 27, 2019, 12:46 p.m. OK GNU C++14 TESTS 22 15 0 1500
63938086 chtnsngh16 B Oct. 31, 2019, 4:33 p.m. OK GNU C++17 TESTS 22 15 0 1500
58460211 vjudge4 B Aug. 8, 2019, 3:58 p.m. OK GNU C++17 TESTS 22 15 0 1500
58437409 HNO2 B Aug. 7, 2019, 2:32 p.m. OK GNU C++17 TESTS 22 15 0 1500
58400942 JustInCase B Aug. 6, 2019, 5:46 p.m. OK GNU C++17 TESTS 22 15 0 1500
55325253 0ng B June 9, 2019, 7:38 a.m. OK GNU C++17 TESTS 22 15 0 1500
54873162 Superuzir B May 31, 2019, 10:26 a.m. OK GNU C++17 TESTS 22 15 0 1500
64512554 valentinmariansavoiu B Nov. 8, 2019, 9:22 a.m. OK GNU C++17 TESTS 22 15 0 1500
64604580 iulianrotaru B Nov. 9, 2019, 7:53 p.m. OK GNU C++17 TESTS 22 15 0 1500
65453585 dragos99 B Nov. 20, 2019, 7:15 p.m. OK GNU C++17 TESTS 22 15 0 1500
68947243 riteshyadav28 B Jan. 16, 2020, 4:38 p.m. OK GNU C++17 TESTS 22 15 0 1500
39766163 Recoder B June 29, 2018, 11:13 a.m. OK Go TESTS 22 31 204800 1500
51951725 MaxHeap B March 28, 2019, 8:48 p.m. OK Java 8 TESTS 22 108 0 1500
57984163 Ikari_stream B July 30, 2019, 10:39 a.m. OK Java 8 TESTS 22 109 0 1500
55590464 adeepgarg13 B June 15, 2019, 12:03 p.m. OK Java 8 TESTS 22 109 0 1500
55590152 adeepgarg13 B June 15, 2019, 11:52 a.m. OK Java 8 TESTS 22 109 0 1500
55427643 zmurzagaliev B June 11, 2019, 9:46 a.m. OK Java 8 TESTS 22 109 0 1500
53945704 jebaited B May 10, 2019, 6:32 a.m. OK Java 8 TESTS 22 109 0 1500
57061987 mcaser B July 14, 2019, 6:36 p.m. OK Java 8 TESTS 22 124 0 1500
64548728 ijxjdjd B Nov. 8, 2019, 9:20 p.m. OK Java 8 TESTS 22 124 0 1500
63615196 goyalnikhil064 B Oct. 27, 2019, 7:07 p.m. OK Java 8 TESTS 22 124 0 1500
51233402 abdallahsameh B March 12, 2019, 5:25 p.m. OK Java 8 TESTS 22 124 0 1500
39658206 elizarov B June 25, 2018, 6:53 p.m. OK Kotlin TESTS 22 170 102400 1500
39616463 ymatsux B June 24, 2018, 5:06 p.m. OK Kotlin TESTS 22 187 1126400 1500
55677537 og.kostya B June 17, 2019, 11:17 a.m. OK Mono C# TESTS 22 46 0 1500
39623773 mircea85 B June 24, 2018, 5:57 p.m. OK Mono C# TESTS 22 46 0 1500
51367835 nemars B March 16, 2019, 10:33 a.m. OK Mono C# TESTS 22 62 3584000 1500
39641997 nik1998 B June 25, 2018, 7:40 a.m. OK MS C++ TESTS 22 15 0 1500
39616163 wa1tz719 B June 24, 2018, 5:05 p.m. OK MS C++ TESTS 22 15 0 1500
39658171 L0u1Za B June 25, 2018, 6:51 p.m. OK MS C++ TESTS 22 15 0 1500
39611754 RAVEman B June 24, 2018, 4:45 p.m. OK MS C++ TESTS 22 30 0 1500
58401988 vjudge5 B Aug. 6, 2019, 6:15 p.m. OK MS C++ TESTS 22 30 0 1500
58402294 vjudge3 B Aug. 6, 2019, 6:25 p.m. OK MS C++ TESTS 22 30 0 1500
57748599 vjudge1 B July 25, 2019, 1:56 p.m. OK MS C++ TESTS 22 30 0 1500
63051940 vjudge4 B Oct. 21, 2019, 3:16 a.m. OK MS C++ TESTS 22 30 102400 1500
42480048 math957963 B Sept. 5, 2018, 4:21 a.m. OK MS C++ TESTS 22 30 307200 1500
39889641 maxi_bomb B July 3, 2018, 9:42 a.m. OK MS C++ TESTS 22 30 307200 1500
68830439 AleksanderBalobanov B Jan. 14, 2020, 9:45 p.m. OK MS C++ 2017 TESTS 22 30 2764800 1500
58135705 IbraheemJanajreh B Aug. 1, 2019, 4 p.m. OK MS C++ 2017 TESTS 22 31 0 1500
65022641 yuanyuan2048 B Nov. 15, 2019, 6:04 a.m. OK MS C++ 2017 TESTS 22 31 0 1500
57744279 vjudge5 B July 25, 2019, 12:28 p.m. OK MS C++ 2017 TESTS 22 31 0 1500
57742534 vjudge5 B July 25, 2019, 11:54 a.m. OK MS C++ 2017 TESTS 22 31 0 1500
57447846 vjudge3 B July 21, 2019, 8:45 a.m. OK MS C++ 2017 TESTS 22 31 0 1500
54719090 Dragostan B May 27, 2019, 3:17 p.m. OK MS C++ 2017 TESTS 22 31 0 1500
51303942 rootuser B March 14, 2019, 3:50 p.m. OK MS C++ 2017 TESTS 22 31 0 1500
57740426 vjudge5 B July 25, 2019, 11:17 a.m. OK MS C++ 2017 TESTS 22 31 2457600 1500
39764627 fondation B June 29, 2018, 10 a.m. OK Ocaml TESTS 22 31 3891200 1500
39675235 fruha B June 26, 2018, 12:22 p.m. OK PascalABC.NET TESTS 22 46 102400 1500
39650109 mayakin B June 25, 2018, 1 p.m. OK PHP TESTS 22 31 0 1500
39702869 nealzane B June 27, 2018, 1:34 p.m. OK PyPy 2 TESTS 22 93 102400 1500
59592518 raj1307 B Aug. 27, 2019, 9:41 p.m. OK PyPy 2 TESTS 22 140 512000 1500
43949419 soumyasarkar1998 B Oct. 7, 2018, 3:29 p.m. OK PyPy 2 TESTS 22 155 0 1500
44841705 test616.cpp B Oct. 25, 2018, 12:59 p.m. OK PyPy 2 TESTS 22 171 0 1500
39613497 --d B June 24, 2018, 4:52 p.m. OK PyPy 3 TESTS 22 124 0 1500
54729421 Aidos B May 27, 2019, 9:55 p.m. OK PyPy 3 TESTS 22 124 204800 1500
58429923 Kireoux B Aug. 7, 2019, 11:25 a.m. OK PyPy 3 TESTS 22 124 1228800 1500
65302668 manish.17 B Nov. 18, 2019, 1:47 p.m. OK PyPy 3 TESTS 22 140 0 1500
61743807 irza_law B Oct. 2, 2019, 10:02 p.m. OK PyPy 3 TESTS 22 140 1331200 1500
60246562 codeboy5 B Sept. 8, 2019, 3:13 a.m. OK PyPy 3 TESTS 22 140 1433600 1500
58386832 SpeedOfMagic B Aug. 6, 2019, 12:16 p.m. OK PyPy 3 TESTS 22 140 1433600 1500
61727375 UTMoonlight B Oct. 2, 2019, 3:50 p.m. OK PyPy 3 TESTS 22 155 0 1500
39937386 RagnarArdal B July 3, 2018, 10:36 p.m. OK PyPy 3 TESTS 22 155 204800 1500
69006430 kchau B Jan. 17, 2020, 11:55 p.m. OK PyPy 3 TESTS 22 171 1331200 1500
39681523 sainitejeshwar B June 26, 2018, 4:53 p.m. OK Python 2 TESTS 22 108 0 1500
39618553 WNG B June 24, 2018, 5:18 p.m. OK Python 2 TESTS 22 109 102400 1500
39760109 pdev250 B June 29, 2018, 6:25 a.m. OK Python 2 TESTS 22 124 6041600 1500
41619908 tnowakow B Aug. 15, 2018, 11:30 a.m. OK Python 2 TESTS 22 155 0 1500
39865998 SoSooding B July 2, 2018, 11:13 a.m. OK Python 2 TESTS 22 156 0 1500
44842170 test616.cpp B Oct. 25, 2018, 1:09 p.m. OK Python 2 TESTS 22 171 0 1500
39790228 candle B June 30, 2018, 7:02 a.m. OK Python 2 TESTS 22 171 0 1500
57747088 vjudge1 B July 25, 2019, 1:25 p.m. OK Python 2 TESTS 22 186 0 1500
39634413 sunhong B June 24, 2018, 11:59 p.m. OK Python 3 TESTS 22 77 0 1500
39729774 orailly B June 28, 2018, 12:24 a.m. OK Python 3 TESTS 22 78 0 1500
39677305 xumouyi B June 26, 2018, 1:50 p.m. OK Python 3 TESTS 22 78 0 1500
39658057 darkshadowrule B June 25, 2018, 6:45 p.m. OK Python 3 TESTS 22 78 0 1500
39646487 Vosatorp B June 25, 2018, 10:32 a.m. OK Python 3 TESTS 22 78 0 1500
39679190 USYD_Yemengchen B June 26, 2018, 3:08 p.m. OK Python 3 TESTS 22 93 0 1500
39674600 tkv B June 26, 2018, 11:54 a.m. OK Python 3 TESTS 22 93 0 1500
39671518 uchiwa_123 B June 26, 2018, 9:35 a.m. OK Python 3 TESTS 22 93 0 1500
39649752 eddy1021 B June 25, 2018, 12:44 p.m. OK Python 3 TESTS 22 93 0 1500
39629210 -is-this-fft- B June 24, 2018, 6:34 p.m. OK Python 3 TESTS 22 93 0 1500

remove filters

Back to search problems