97132024-03-02 14:09:31szellandBob Baba Zárójelsorozatapython3Wrong answer 0/10045ms15792 KiB
def inSplit(l):
    for i in range(len(l)):
        l[i-1] = int(l[i-1])
    return l

n = int(input())

m = list(input().split(" "))
m = inSplit(m)

p = sum(m)

k = [] # 0 > nyitó z jel, 1 > csuko z jel
a = True
nyit = 0

for i in m:
    if nyit > int(p / 2):
        print(-1)
        a = False
        break

    if nyit - i >= 0:
        for j in range(i):
            k.append(1)
            nyit -= 1
    else:
        for j in range(i):
            k.append(0)
            nyit += 1

out = ""

for i in k:
    if i == 0:
        out += "("
    else:
        out += ")"
if a:
    print(out)
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms11260 KiB
2Accepted17ms11444 KiB
3Accepted17ms11528 KiB
subtask20/20
4Wrong answer30ms12660 KiB
5Wrong answer37ms12872 KiB
6Accepted23ms12352 KiB
subtask30/30
7Wrong answer17ms12464 KiB
8Wrong answer17ms12752 KiB
9Wrong answer17ms12688 KiB
10Wrong answer17ms12496 KiB
11Wrong answer17ms12616 KiB
subtask40/50
12Wrong answer41ms14028 KiB
13Wrong answer41ms14012 KiB
14Wrong answer41ms13980 KiB
15Wrong answer41ms13912 KiB
16Wrong answer43ms14444 KiB
17Wrong answer41ms14420 KiB
18Wrong answer43ms14600 KiB
19Wrong answer43ms14664 KiB
20Wrong answer43ms14988 KiB
21Wrong answer41ms14804 KiB
22Wrong answer41ms14616 KiB
23Wrong answer41ms14684 KiB
24Wrong answer43ms14828 KiB
25Wrong answer43ms14964 KiB
26Wrong answer41ms14620 KiB
27Wrong answer45ms14804 KiB
28Wrong answer43ms15032 KiB
29Wrong answer41ms15096 KiB
30Wrong answer43ms15420 KiB
31Wrong answer43ms15448 KiB
32Wrong answer43ms15592 KiB
33Wrong answer43ms15712 KiB
34Wrong answer41ms15604 KiB
35Wrong answer41ms15752 KiB
36Wrong answer43ms15564 KiB
37Wrong answer43ms15644 KiB
38Wrong answer45ms15620 KiB
39Wrong answer43ms15360 KiB
40Wrong answer43ms15676 KiB
41Wrong answer41ms15568 KiB
42Wrong answer43ms15432 KiB
43Wrong answer43ms15480 KiB
44Wrong answer41ms15604 KiB
45Wrong answer43ms15704 KiB
46Wrong answer43ms15792 KiB
47Wrong answer43ms15624 KiB
48Wrong answer41ms15764 KiB
49Wrong answer43ms15636 KiB
50Wrong answer41ms15388 KiB
51Wrong answer43ms15740 KiB
52Wrong answer43ms15596 KiB
53Wrong answer41ms15656 KiB
54Wrong answer41ms15740 KiB
55Wrong answer41ms15656 KiB
56Wrong answer41ms15616 KiB
57Wrong answer41ms15588 KiB
58Wrong answer41ms15652 KiB