97122024-03-02 13:57:34Bandi2134Bob Baba Zárójelsorozatapython3Wrong answer 0/10043ms15888 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
1Wrong answer17ms11488 KiB
2Accepted18ms11660 KiB
3Accepted17ms11904 KiB
subtask20/20
4Wrong answer29ms12700 KiB
5Wrong answer37ms12804 KiB
6Wrong answer19ms12284 KiB
subtask30/30
7Wrong answer17ms12592 KiB
8Wrong answer17ms12672 KiB
9Wrong answer17ms12932 KiB
10Wrong answer17ms12820 KiB
11Wrong answer18ms12688 KiB
subtask40/50
12Wrong answer41ms13768 KiB
13Wrong answer43ms14048 KiB
14Wrong answer41ms13996 KiB
15Wrong answer43ms14116 KiB
16Wrong answer43ms14568 KiB
17Wrong answer41ms14468 KiB
18Wrong answer41ms14652 KiB
19Wrong answer43ms14856 KiB
20Wrong answer43ms14540 KiB
21Wrong answer41ms14612 KiB
22Wrong answer41ms14416 KiB
23Wrong answer43ms14520 KiB
24Wrong answer41ms14516 KiB
25Wrong answer43ms14632 KiB
26Wrong answer41ms14944 KiB
27Wrong answer41ms15056 KiB
28Wrong answer41ms14740 KiB
29Wrong answer41ms15116 KiB
30Wrong answer43ms15076 KiB
31Wrong answer41ms15140 KiB
32Wrong answer41ms14916 KiB
33Wrong answer41ms15168 KiB
34Wrong answer41ms15324 KiB
35Wrong answer41ms15604 KiB
36Wrong answer41ms15556 KiB
37Wrong answer41ms15576 KiB
38Wrong answer43ms15548 KiB
39Wrong answer43ms15484 KiB
40Wrong answer41ms15384 KiB
41Wrong answer43ms15328 KiB
42Wrong answer43ms15520 KiB
43Wrong answer43ms15552 KiB
44Wrong answer41ms15408 KiB
45Wrong answer43ms15288 KiB
46Wrong answer41ms15568 KiB
47Wrong answer41ms15488 KiB
48Wrong answer43ms15332 KiB
49Wrong answer41ms15280 KiB
50Wrong answer41ms15420 KiB
51Wrong answer43ms15564 KiB
52Wrong answer43ms15720 KiB
53Wrong answer43ms15680 KiB
54Wrong answer43ms15584 KiB
55Wrong answer43ms15408 KiB
56Wrong answer41ms15728 KiB
57Wrong answer41ms15828 KiB
58Wrong answer41ms15888 KiB