Skip to content

mgalang229/Codeforces-1503A-Balance-the-Bits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Codeforces-1503A-Balance-the-Bits

Link: https://codeforces.com/problemset/problem/1503/A

Test Case

Sample Input:

1
18
100110011000110001

Sample Output:

YES
()((()(())()))()()
(()((()()()()))())

Explanation

1 0 0 1 1 0 0 1 1 0 0 0 1 1 0 0 0 1
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? => a
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? => b

"if" part in the code: 
1 0 0 1 1 0 0 1 1 0 0 0 1 1 0 0 0 1
( ? ? ( ( ? ? ( ) ? ? ? ) ) ? ? ? ) => a
( ? ? ( ( ? ? ( ) ? ? ? ) ) ? ? ? ) => b

note: there are 8 "1"s so 4 must be open brackets and the remaining must be closing brackets

"else" part in the code:
1 0 0 1 1 0 0 1 1 0 0 0 1 1 0 0 0 1
( ) ( ( ( ) ( ( ) ) ( ) ) ) ( ) ( ) => a
( ( ) ( ( ( ) ( ) ( ) ( ) ) ) ( ) ) => b

string "a" should be alternating ), (, ), (, ...
string "b" should be alternating (, ), (, ), ...

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages