Case #1: ((22222))


On Wednesday, April 8, 2020 at 10:36:20 AM UTC+2, Paul Smith wrote:
>
> What is your output for 22222?
>
> It should be ((22222)) but I think you’ll get ((2))2222 with your program?
>
> On Wed, 8 Apr 2020 at 05:30, Avinash Bhardwaj <avinash....@gmail.com 
> <javascript:>> wrote:
>
>> lification Round 2020 - Code Jam 2020
>>
>>
>> timeline
>> 3
>>
>> question_answer
>> Nesting Depth (5pts, 11pts)
>>
>> Practice Submissions
>> Attempt 1
>> Sample Failed: WA
>> Apr 5 2020, 09:03
>> remove_red_eye
>> Competitive Submissions
>> Attempt 2
>> Sample Failed: WA
>> 19:43:51
>> remove_red_eye
>> Attempt 1
>> Sample Failed: WA
>> 19:41:01
>> remove_red_eye
>> Last updated: Apr 8 2020, 09:36
>>
>> PROBLEM
>> ANALYSIS
>> Problem
>> tl;dr: Given a string of digits S, insert a minimum number of opening and 
>> closing parentheses into it such that the resulting string is balanced and 
>> each digit d is inside exactly d pairs of matching parentheses.
>>
>> Let the nesting of two parentheses within a string be the substring that 
>> occurs strictly between them. An opening parenthesis and a closing 
>> parenthesis that is further to its right are said to match if their nesting 
>> is empty, or if every parenthesis in their nesting matches with another 
>> parenthesis in their nesting. The nesting depth of a position p is the 
>> number of pairs of matching parentheses m such that p is included in the 
>> nesting of m.
>>
>> For example, in the following strings, all digits match their nesting 
>> depth: 0((2)1), (((3))1(2)), ((((4)))), ((2))((2))(1). The first three 
>> strings have minimum length among those that have the same digits in the 
>> same order, but the last one does not since ((22)1) also has the digits 221 
>> and is shorter.
>>
>> Given a string of digits S, find another string S', comprised of 
>> parentheses and digits, such that:
>> all parentheses in S' match some other parenthesis,
>> removing any and all parentheses from S' results in S,
>> each digit in S' is equal to its nesting depth, and
>> S' is of minimum length.
>>
>> Input
>> The first line of the input gives the number of test cases, T. T lines 
>> follow. Each line represents a test case and contains only the string S.
>>
>> Output
>> For each test case, output one line containing Case #x: y, where x is the 
>> test case number (starting from 1) and y is the string S' defined above.
>>
>> Limits
>> Time limit: 20 seconds per test set.
>> Memory limit: 1GB.
>> 1 ≤ T ≤ 100.
>> 1 ≤ length of S ≤ 100.
>>
>> Test set 1 (Visible Verdict)
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Google Code Jam" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to googl...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-code/ad9651e4-1f96-437e-a18f-69c2b5a36159%40googlegroups.com
>> .
>>
> -- 
> Paul Smith
>
> pa...@pollyandpaul.co.uk <javascript:>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/88cda498-fb87-4447-9be9-f28df1a2e75a%40googlegroups.com.

Reply via email to