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 |
|---|---|---|---|---|---|---|
| 234 | Codeforces Round 145 (Div. 2, ACM-ICPC Rules) | FINISHED | False | 12600 | 426034823 | Oct. 16, 2012, 7 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 619 ) | H | Merging Two Decks | PROGRAMMING | constructive algorithms greedy | 2100 |
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to do it in two stages. The first stage is to merge the two decks in such a way that the relative order of the cards from the same deck doesn't change. That is, for any two different cards i and j in one deck, if card i lies above card j , then after the merge card i must also be above card j . The second stage is performed on the deck that resulted from the first stage. At this stage, the executed operation is the turning operation. In one turn you can take a few of the top cards, turn all of them, and put them back. Thus, each of the taken cards gets turned and the order of these cards is reversed. That is, the card that was on the bottom before the turn, will be on top after it. Your task is to make sure that all the cards are lying face down. Find such an order of merging cards in the first stage and the sequence of turning operations in the second stage, that make all the cards lie face down, and the number of turns is minimum. The first input line contains a single integer n — the number of cards in the first deck (1 ≤ n ≤ 10 5 ) . The second input line contains n integers, separated by single spaces a 1 , a 2 , ..., a n (0 ≤ a i ≤ 1) . Value a i equals 0, if the i -th card is lying face down, and 1, if the card is lying face up. The cards are given in the order from the topmost one to the bottommost one. The third input line contains integer m — the number of cards in the second deck (1 ≤ m ≤ 10 5 ) . The fourth input line contains m integers, separated by single spaces b 1 , b 2 , ..., b m (0 ≤ b i ≤ 1) . Value b i equals 0, if the i -th card is lying face down, and 1, if the card is lying face up. The cards are given in the order from the topmost to the bottommost. In the first line print n + m space-separated integers — the numbers of |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 2375353 | vilcheuski | H | Oct. 16, 2012, 4:46 p.m. | OK | Delphi | TESTS | 60 | 93 | 8908800 | 2100 | |
| 2467504 | AleksanderBalobanov | H | Oct. 29, 2012, 2:51 p.m. | OK | Delphi | TESTS | 60 | 93 | 32153600 | 2100 | |
| 2391052 | kalabukdima | H | Oct. 20, 2012, 4:02 p.m. | OK | FPC | TESTS | 60 | 78 | 2764800 | 2100 | |
| 2381072 | Dima_qwer | H | Oct. 17, 2012, 6:44 p.m. | OK | FPC | TESTS | 60 | 78 | 3686400 | 2100 | |
| 2374473 | kaolavinh1417 | H | Oct. 16, 2012, 2:56 p.m. | OK | FPC | TESTS | 60 | 78 | 6451200 | 2100 | |
| 2391537 | Anastasiya.Zhyr | H | Oct. 20, 2012, 6:46 p.m. | OK | FPC | TESTS | 60 | 93 | 1945600 | 2100 | |
| 2369665 | hung06061111 | H | Oct. 16, 2012, 8:56 a.m. | OK | FPC | TESTS | 60 | 93 | 3788800 | 2100 | |
| 40990611 | ReaLNero1 | H | July 31, 2018, 12:04 a.m. | OK | FPC | TESTS | 60 | 154 | 6451200 | 2100 | |
| 2479928 | mxalbert1996 | H | Nov. 1, 2012, 3:21 p.m. | OK | FPC | TESTS | 60 | 1234 | 1945600 | 2100 | |
| 2984158 | gxnncrx1993 | H | Jan. 22, 2013, 2:37 p.m. | OK | GNU C | TESTS | 60 | 140 | 18022400 | 2100 | |
| 2371653 | frussi | H | Oct. 16, 2012, 9:56 a.m. | OK | GNU C++ | TESTS | 60 | 93 | 1433600 | 2100 | |
| 2374346 | ccdd4211 | H | Oct. 16, 2012, 2:46 p.m. | OK | GNU C++ | TESTS | 60 | 93 | 4608000 | 2100 | |
| 2375727 | Alisafe | H | Oct. 16, 2012, 5:47 p.m. | OK | GNU C++ | TESTS | 60 | 109 | 2355200 | 2100 | |
| 2371013 | nakari1124 | H | Oct. 16, 2012, 9:34 a.m. | OK | GNU C++ | TESTS | 60 | 109 | 2969600 | 2100 | |
| 2495816 | boleyn.su | H | Nov. 3, 2012, 6:22 p.m. | OK | GNU C++ | TESTS | 60 | 109 | 3072000 | 2100 | |
| 2370320 | Petroleum | H | Oct. 16, 2012, 9:12 a.m. | OK | GNU C++ | TESTS | 60 | 109 | 3072000 | 2100 | |
| 2370312 | adamant | H | Oct. 16, 2012, 9:12 a.m. | OK | GNU C++ | TESTS | 60 | 109 | 3072000 | 2100 | |
| 2370290 | melfice | H | Oct. 16, 2012, 9:11 a.m. | OK | GNU C++ | TESTS | 60 | 109 | 3072000 | 2100 | |
| 2376753 | mamekin | H | Oct. 17, 2012, 2:42 a.m. | OK | GNU C++ | TESTS | 60 | 109 | 3584000 | 2100 | |
| 2376657 | roypalacios | H | Oct. 17, 2012, 1:42 a.m. | OK | GNU C++ | TESTS | 60 | 109 | 3686400 | 2100 | |
| 6101157 | marat.snowbear | H | March 21, 2014, 10:55 p.m. | OK | GNU C++0x | TESTS | 60 | 124 | 3174400 | 2100 | |
| 2371136 | goldvitaly | H | Oct. 16, 2012, 9:39 a.m. | OK | GNU C++0x | TESTS | 60 | 125 | 2560000 | 2100 | |
| 7156462 | FAU.blau | H | July 19, 2014, 10:33 a.m. | OK | GNU C++0x | TESTS | 60 | 154 | 3993600 | 2100 | |
| 3358851 | EarlOfDitches | H | March 19, 2013, 9:53 p.m. | OK | GNU C++0x | TESTS | 60 | 156 | 4198400 | 2100 | |
| 2513187 | 135678942570 | H | Nov. 6, 2012, 4:27 a.m. | OK | GNU C++0x | TESTS | 60 | 156 | 4198400 | 2100 | |
| 2394926 | zakharvoit | H | Oct. 21, 2012, 4:59 a.m. | OK | GNU C++0x | TESTS | 60 | 156 | 13107200 | 2100 | |
| 2376054 | sping128 | H | Oct. 16, 2012, 6:59 p.m. | OK | GNU C++0x | TESTS | 60 | 203 | 5324800 | 2100 | |
| 2750628 | ArkChar | H | Dec. 11, 2012, 10:29 a.m. | OK | GNU C++0x | TESTS | 60 | 468 | 13414400 | 2100 | |
| 10289222 | Nik_Storm_2010 | H | March 15, 2015, 1:35 p.m. | OK | GNU C++0x | TESTS | 60 | 498 | 3788800 | 2100 | |
| 14057073 | stefanzzz | H | Nov. 4, 2015, 12:24 p.m. | OK | GNU C++11 | TESTS | 60 | 186 | 2355200 | 2100 | |
| 15023238 | imrusty | H | Dec. 25, 2015, 10:17 p.m. | OK | GNU C++11 | TESTS | 60 | 186 | 3072000 | 2100 | |
| 15021508 | imrusty | H | Dec. 25, 2015, 6:59 p.m. | OK | GNU C++11 | TESTS | 60 | 186 | 3174400 | 2100 | |
| 54499532 | WOSHIGEPACHONG2 | H | May 22, 2019, 7:46 p.m. | OK | GNU C++11 | TESTS | 60 | 186 | 4403200 | 2100 | |
| 50668577 | AIice | H | March 2, 2019, 5:49 a.m. | OK | GNU C++11 | TESTS | 60 | 186 | 4403200 | 2100 | |
| 29778790 | nikola12345 | H | Aug. 25, 2017, 12:18 p.m. | OK | GNU C++11 | TESTS | 60 | 186 | 4812800 | 2100 | |
| 28677410 | Matrix.code | H | July 18, 2017, 7:54 p.m. | OK | GNU C++11 | TESTS | 60 | 310 | 8908800 | 2100 | |
| 60733796 | sorry_im_smurfing | H | Sept. 17, 2019, 4:42 p.m. | OK | GNU C++11 | TESTS | 60 | 404 | 2560000 | 2100 | |
| 58049283 | vjudge4 | H | July 31, 2019, 1:52 a.m. | OK | GNU C++11 | TESTS | 60 | 404 | 2560000 | 2100 | |
| 57898955 | lopare | H | July 28, 2019, 2:50 p.m. | OK | GNU C++11 | TESTS | 60 | 404 | 2560000 | 2100 | |
| 25649486 | _AymanSalah | H | March 19, 2017, 3:22 p.m. | OK | GNU C++14 | TESTS | 60 | 186 | 6553600 | 2100 | |
| 24604222 | thabetx | H | Feb. 12, 2017, 8:19 a.m. | OK | GNU C++14 | TESTS | 60 | 186 | 7475200 | 2100 | |
| 24603941 | thabetx | H | Feb. 12, 2017, 8:02 a.m. | OK | GNU C++14 | TESTS | 60 | 186 | 7475200 | 2100 | |
| 25535025 | SayedEl-Abady | H | March 15, 2017, 11:14 p.m. | OK | GNU C++14 | TESTS | 60 | 186 | 8089600 | 2100 | |
| 58056192 | vjudge3 | H | July 31, 2019, 5:21 a.m. | OK | GNU C++14 | TESTS | 60 | 186 | 9011200 | 2100 | |
| 62674331 | _no0B | H | Oct. 16, 2019, 10:57 a.m. | OK | GNU C++14 | TESTS | 60 | 216 | 4096000 | 2100 | |
| 22030986 | McGinn | H | Nov. 4, 2016, 9:38 a.m. | OK | GNU C++14 | TESTS | 60 | 218 | 2560000 | 2100 | |
| 29932309 | anmol.bhandari.eee13 | H | Aug. 30, 2017, 9:04 p.m. | OK | GNU C++14 | TESTS | 60 | 218 | 3276800 | 2100 | |
| 58056040 | vjudge1 | H | July 31, 2019, 5:16 a.m. | OK | GNU C++14 | TESTS | 60 | 218 | 6963200 | 2100 | |
| 32343083 | Emsawy | H | Nov. 15, 2017, 10:47 p.m. | OK | GNU C++14 | TESTS | 60 | 374 | 3481600 | 2100 | |
| 61709533 | ivan100sic | H | Oct. 2, 2019, 11:08 a.m. | OK | GNU C++17 | TESTS | 60 | 186 | 3072000 | 2100 | |
| 50516728 | ruo | H | Feb. 26, 2019, 6:55 a.m. | OK | GNU C++17 | TESTS | 60 | 216 | 4505600 | 2100 | |
| 43452657 | fblogy | H | Sept. 26, 2018, 1:48 p.m. | OK | GNU C++17 | TESTS | 60 | 216 | 7065600 | 2100 | |
| 4021019 | nickie | H | July 4, 2013, 3:05 p.m. | OK | Haskell | TESTS | 60 | 312 | 24473600 | 2100 | |
| 2464782 | giannis.spiliopoulos | H | Oct. 28, 2012, 8:38 p.m. | OK | Haskell | TESTS | 60 | 390 | 27443200 | 2100 | |
| 3661290 | Mostafa.Ali | H | May 2, 2013, 6:56 p.m. | OK | Java 6 | TESTS | 60 | 250 | 409600 | 2100 | |
| 2376380 | xiaowuc1 | H | Oct. 16, 2012, 9:11 p.m. | OK | Java 6 | TESTS | 60 | 265 | 819200 | 2100 | |
| 2371736 | di_halt | H | Oct. 16, 2012, 10 a.m. | OK | Java 6 | TESTS | 60 | 296 | 10854400 | 2100 | |
| 2372465 | JKesha | H | Oct. 16, 2012, 10:24 a.m. | OK | Java 6 | TESTS | 60 | 421 | 21504000 | 2100 | |
| 2419770 | arya5691 | H | Oct. 24, 2012, 3:13 a.m. | OK | Java 6 | TESTS | 60 | 437 | 15769600 | 2100 | |
| 2378495 | nitegazer | H | Oct. 17, 2012, 10:22 a.m. | OK | Java 7 | TESTS | 60 | 187 | 307200 | 2100 | |
| 2495334 | Thomas_Ahle | H | Nov. 3, 2012, 3:42 p.m. | OK | Java 7 | TESTS | 60 | 218 | 0 | 2100 | |
| 2441919 | mostafa_fahim | H | Oct. 27, 2012, 10:56 a.m. | OK | Java 7 | TESTS | 60 | 1125 | 921600 | 2100 | |
| 2657906 | gotoac | H | Nov. 26, 2012, 12:30 p.m. | OK | MS C++ | TESTS | 60 | 171 | 2560000 | 2100 | |
| 2564288 | tomas.svab | H | Nov. 15, 2012, 4:01 p.m. | OK | MS C++ | TESTS | 60 | 171 | 3072000 | 2100 | |
| 2381057 | Dok-95 | H | Oct. 17, 2012, 6:38 p.m. | OK | MS C++ | TESTS | 60 | 187 | 4198400 | 2100 | |
| 2376621 | YX201314 | H | Oct. 17, 2012, 12:57 a.m. | OK | MS C++ | TESTS | 60 | 187 | 4198400 | 2100 | |
| 2378528 | zjut_DD | H | Oct. 17, 2012, 10:28 a.m. | OK | MS C++ | TESTS | 60 | 203 | 2355200 | 2100 | |
| 2405760 | kostyabazhanov | H | Oct. 21, 2012, 7:12 p.m. | OK | MS C++ | TESTS | 60 | 203 | 20889600 | 2100 | |
| 8878040 | Mosyagin | H | Nov. 28, 2014, 11:21 a.m. | OK | MS C++ | TESTS | 60 | 216 | 3584000 | 2100 | |
| 4679034 | james007 | H | Oct. 5, 2013, 8:49 a.m. | OK | MS C++ | TESTS | 60 | 248 | 3276800 | 2100 | |
| 2696540 | vshantarin | H | Dec. 5, 2012, 10:27 a.m. | OK | MS C++ | TESTS | 60 | 265 | 3788800 | 2100 | |
| 2376282 | AlexanderL | H | Oct. 16, 2012, 8:29 p.m. | OK | MS C++ | TESTS | 60 | 328 | 2560000 | 2100 | |
| 54783561 | pajenegod | H | May 29, 2019, 1:28 a.m. | OK | PyPy 2 | TESTS | 60 | 466 | 20684800 | 2100 | |
| 40445875 | xionghuixin2018 | H | July 16, 2018, 4:38 p.m. | OK | PyPy 3 | TESTS | 60 | 716 | 22630400 | 2100 | |
| 40446943 | xionghuixin2018 | H | July 16, 2018, 4:53 p.m. | OK | PyPy 3 | TESTS | 60 | 748 | 22732800 | 2100 | |
| 40404320 | xionghuixin2018 | H | July 16, 2018, 9:01 a.m. | OK | PyPy 3 | TESTS | 60 | 748 | 22732800 | 2100 | |
| 2420105 | abc_1988_1106 | H | Oct. 24, 2012, 6:38 a.m. | OK | Python 2 | TESTS | 60 | 625 | 13721600 | 2100 | |
| 2375416 | kost | H | Oct. 16, 2012, 4:57 p.m. | OK | Python 2 | TESTS | 60 | 640 | 17920000 | 2100 | |
| 2418677 | Jay_Chou | H | Oct. 23, 2012, 5:13 p.m. | OK | Python 2 | TESTS | 60 | 796 | 16179200 | 2100 |
Back to search problems