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 119719463 April 3, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 185 ) F Balance the Cards PROGRAMMING constructive algorithms data structures divide and conquer geometry graphs implementation 3500

B'A balanced bracket sequence is defined as an integer sequence that can be built with the following rules: The positive numbers can be imagined as opening brackets and the negative numbers as closing brackets, where matching brackets must have the same type (absolute value). For example, [1, 2, -2, -1] and [1, 3, -3, 2, -2, -1] are balanced, but [1, 2, -1, -2] and [-1, 1] are not balanced. There are 2n cards. Each card has a number on the front and a number on the back. Each integer 1,-1,2,-2, ldots,n,-n appears exactly once on the front of some card and exactly once on the back of some (not necessarily the same) card. You can reorder the cards however you like. You are not allowed to flip cards, so numbers cannot move between the front and back. Your task is to order the cards so that the sequences given by the front numbers and the back numbers are both balanced, or report that it is impossible. The first line contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of bracket types, and half the number of cards. The next 2n lines describe the cards. The i -th of these lines contains two integers a_i , b_i ( -n <= a_i,b_i <= n , a_i ne 0 , b_i ne 0 ) -- the numbers on the front and back of the i -th card, respectively. Every integer 1,-1,2,-2, ldots,n,-n appears exactly once as a_i and exactly once as b_i . On the first line, output "YES" if it 's possible to reorder these cards to satisfy the condition. Otherwise, output "NO". You can print each letter in any case (upper or lower). If it is possible, on the next 2n lines output the cards in an order so that the front and back are both balanced. If there are multiple solutions, you may output any. In the first test case, the front numbers create the balanced sequence [1,4,-4,-1,5,3,2,-2,-3,-5] and the back numbers create the balanced sequence [3,-3,4,-4,1,-1,2,5,-5,-2] . In '...

Tutorials

T

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
111949375 rainboy F April 3, 2021, 7:51 p.m. OK GNU C11 TESTS 48 1809 21606400 3500
111942068 Radewoosh F April 3, 2021, 5:59 p.m. OK GNU C++14 TESTS 48 920 56934400 3500
111949440 rainboy F April 3, 2021, 7:52 p.m. OK GNU C++17 TESTS 48 358 21606400 3500
111936345 ksun48 F April 3, 2021, 4:47 p.m. OK GNU C++17 TESTS 48 685 74752000 3500
111946634 i_m_swachha F April 3, 2021, 6:54 p.m. OK GNU C++17 TESTS 48 2854 86118400 3500
111939776 ksun48 F April 3, 2021, 5:41 p.m. OK GNU C++17 TESTS 48 2979 86016000 3500
111940940 01aglupal F April 3, 2021, 5:49 p.m. OK GNU C++17 TESTS 48 2979 86016000 3500
111968974 unseenwarrior F April 4, 2021, 5:50 a.m. OK GNU C++17 TESTS 48 2995 86118400 3500
111939809 nor F April 3, 2021, 5:41 p.m. OK GNU C++17 (64) TESTS 48 311 181452800 3500
111948141 ecnerwala F April 3, 2021, 7:20 p.m. OK GNU C++17 (64) TESTS 48 312 16076800 3500
111947867 ecnerwala F April 3, 2021, 7:15 p.m. OK GNU C++17 (64) TESTS 48 343 22528000 3500
111939857 nor F April 3, 2021, 5:42 p.m. OK GNU C++17 (64) TESTS 48 374 181452800 3500
111949402 rainboy F April 3, 2021, 7:52 p.m. OK GNU C++17 (64) TESTS 48 389 21606400 3500
111950395 1-gon F April 3, 2021, 8:12 p.m. OK GNU C++17 (64) TESTS 48 452 78028800 3500
111944734 jiangly F April 3, 2021, 6:28 p.m. OK GNU C++17 (64) TESTS 48 467 20172800 3500
111940018 nor F April 3, 2021, 5:43 p.m. OK GNU C++17 (64) TESTS 48 561 181350400 3500
111939934 nor F April 3, 2021, 5:42 p.m. OK GNU C++17 (64) TESTS 48 592 181350400 3500
111953640 Benq F April 3, 2021, 9:35 p.m. OK GNU C++17 (64) TESTS 48 670 48640000 3500

remove filters

Back to search problems