Codeforces Round 712 (Div. 1)

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
1503 Codeforces Round 712 (Div. 1) FINISHED False 8100 119892311 April 3, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1142 ) D Flip the Cards PROGRAMMING 2-sat constructive algorithms data structures ds greedy sortings 2600

B'There is a deck of n cards. The i -th card has a number a_i on the front and a number b_i on the back. Every integer between 1 and 2n appears exactly once on the cards. A deck is called sorted if the front values are in increasing order and the back values are in decreasing order. That is, if a_i< a_{i+1} and b_i> b_{i+1} for all 1 <= i<n . To flip a card i means swapping the values of a_i and b_i . You must flip some subset of cards (possibly, none), then put all the cards in any order you like. What is the minimum number of cards you must flip in order to sort the deck? The first line contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of cards. The next n lines describe the cards. The i -th of these lines contains two integers a_i, b_i ( 1 <= a_i, b_i <= 2n ). Every integer between 1 and 2n appears exactly once. If it is impossible to sort the deck, output "-1". Otherwise, output the minimum number of flips required to sort the deck. In the first test case, we flip the cards (1, 9) and (2, 7) . The deck is then ordered (3,10), (5,8), (6,4), (7,2), (9,1) . It is sorted because 3<5<6<7<9 and 10>8>4>2>1 . In the second test case, it is impossible to sort the deck. '...

Tutorials

T

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
111919341 hos.lyric D April 3, 2021, 4 p.m. OK D TESTS 39 358 24371200 2600
111959280 froggyzhang D April 4, 2021, 1:47 a.m. OK GNU C++11 TESTS 44 46 7270400 2600
111934992 starusc D April 3, 2021, 4:43 p.m. OK GNU C++11 TESTS 39 46 9625600 2600
111962610 yan_qiu_ynlchrz D April 4, 2021, 3:27 a.m. OK GNU C++11 TESTS 44 77 5836800 2600
111962794 Kubic D April 4, 2021, 3:31 a.m. OK GNU C++11 TESTS 44 78 1843200 2600
111961330 Inf_Voltage D April 4, 2021, 2:53 a.m. OK GNU C++11 TESTS 44 78 2457600 2600
111945461 aa2985759 D April 3, 2021, 6:37 p.m. OK GNU C++11 TESTS 42 78 4812800 2600
111962903 AquaMoon D April 4, 2021, 3:34 a.m. OK GNU C++11 TESTS 44 78 16076800 2600
111931909 zhangguangxuan99 D April 3, 2021, 4:34 p.m. OK GNU C++11 TESTS 39 93 6860800 2600
111924579 Apsara D April 3, 2021, 4:14 p.m. OK GNU C++11 TESTS 39 93 8089600 2600
111958443 iqx37f D April 4, 2021, 1:09 a.m. OK GNU C++11 TESTS 44 93 16076800 2600
111958362 zoxl D April 4, 2021, 1:05 a.m. OK GNU C++14 TESTS 44 124 3993600 2600
111969052 Neal_lee D April 4, 2021, 5:51 a.m. OK GNU C++14 TESTS 44 124 3993600 2600
111916882 lucaperju D April 3, 2021, 3:54 p.m. OK GNU C++14 TESTS 39 139 5632000 2600
111910826 y1s1 D April 3, 2021, 3:40 p.m. OK GNU C++14 TESTS 39 139 7168000 2600
111913699 Amoo_Safar D April 3, 2021, 3:47 p.m. OK GNU C++14 TESTS 39 139 16384000 2600
111906465 Noam527 D April 3, 2021, 3:31 p.m. OK GNU C++14 TESTS 39 140 7987200 2600
111934105 Potassium D April 3, 2021, 4:41 p.m. OK GNU C++14 TESTS 39 140 8192000 2600
111919628 Farhod_Farmon D April 3, 2021, 4:01 p.m. OK GNU C++14 TESTS 39 155 4198400 2600
111909341 peti1234 D April 3, 2021, 3:37 p.m. OK GNU C++14 TESTS 39 155 5427200 2600
111935092 wifiiiiii D April 3, 2021, 4:44 p.m. OK GNU C++14 TESTS 39 155 11673600 2600
111969755 Chirography_11 D April 4, 2021, 6:01 a.m. OK GNU C++17 TESTS 44 93 4812800 2600
111955513 Zain D April 3, 2021, 10:39 p.m. OK GNU C++17 TESTS 42 93 8396800 2600
111948473 DrSwad D April 3, 2021, 7:26 p.m. OK GNU C++17 TESTS 42 109 15360000 2600
111931286 btzy D April 3, 2021, 4:33 p.m. OK GNU C++17 TESTS 39 124 3174400 2600
111941768 Geothermal D April 3, 2021, 5:56 p.m. OK GNU C++17 TESTS 41 124 3584000 2600
111940904 MAOoo D April 3, 2021, 5:49 p.m. OK GNU C++17 TESTS 41 124 5632000 2600
111969392 Zap D April 4, 2021, 5:55 a.m. OK GNU C++17 TESTS 44 124 7987200 2600
111948589 Sorting D April 3, 2021, 7:28 p.m. OK GNU C++17 TESTS 42 124 10547200 2600
111954511 zucyo05 D April 3, 2021, 10:03 p.m. OK GNU C++17 TESTS 42 124 57344000 2600
111951154 couplefire D April 3, 2021, 8:28 p.m. OK GNU C++17 TESTS 42 139 3584000 2600
111955114 WeakestTopology D April 3, 2021, 10:25 p.m. OK GNU C++17 (64) TESTS 42 92 1638400 2600
111946649 tabr D April 3, 2021, 6:54 p.m. OK GNU C++17 (64) TESTS 42 92 3993600 2600
111930580 Nanored D April 3, 2021, 4:31 p.m. OK GNU C++17 (64) TESTS 39 93 1740800 2600
111916472 ecnerwala D April 3, 2021, 3:53 p.m. OK GNU C++17 (64) TESTS 39 93 3174400 2600
111950351 1-gon D April 3, 2021, 8:11 p.m. OK GNU C++17 (64) TESTS 42 93 4198400 2600
111966049 generic_placeholder_name D April 4, 2021, 4:54 a.m. OK GNU C++17 (64) TESTS 44 93 4608000 2600
111909987 wjli D April 3, 2021, 3:38 p.m. OK GNU C++17 (64) TESTS 39 93 4812800 2600
111956437 Xellos D April 3, 2021, 11:26 p.m. OK GNU C++17 (64) TESTS 44 93 6451200 2600
111969618 tabr D April 4, 2021, 5:59 a.m. OK GNU C++17 (64) TESTS 44 93 6451200 2600
111923925 Sana D April 3, 2021, 4:12 p.m. OK GNU C++17 (64) TESTS 39 93 6758400 2600
111921264 uwi D April 3, 2021, 4:05 p.m. OK Java 11 TESTS 39 888 10137600 2600
111937567 dalt D April 3, 2021, 4:49 p.m. OK Java 8 TESTS 39 810 45670400 2600
111942935 Tlatoani D April 3, 2021, 6:08 p.m. OK Kotlin TESTS 41 717 10342400 2600
111953824 .I. D April 3, 2021, 9:40 p.m. OK .NET Core C# TESTS 42 311 17510400 2600
111927579 keymoon D April 3, 2021, 4:22 p.m. OK .NET Core C# TESTS 39 1045 46592000 2600
111942747 FlakeLCR D April 3, 2021, 6:06 p.m. OK PyPy 3 TESTS 41 233 20070400 2600
111943093 FlakeLCR D April 3, 2021, 6:10 p.m. OK PyPy 3 TESTS 42 248 20070400 2600
111939683 kclee2172 D April 3, 2021, 5:41 p.m. OK PyPy 3 TESTS 39 374 23040000 2600
111933248 tamato D April 3, 2021, 4:39 p.m. OK PyPy 3 TESTS 39 390 18022400 2600
111913534 conqueror_of_tourist D April 3, 2021, 3:46 p.m. OK PyPy 3 TESTS 39 545 14233600 2600
111940976 VTifand D April 3, 2021, 5:49 p.m. OK PyPy 3 TESTS 41 733 42496000 2600
111929330 Kiri8128 D April 3, 2021, 4:27 p.m. OK PyPy 3 TESTS 39 904 22732800 2600
111934822 nwi D April 3, 2021, 4:43 p.m. OK Python 2 TESTS 39 654 27238400 2600

remove filters

Back to search problems