97082024-03-02 13:41:16szellandBob Baba Zárójelsorozatapython3Wrong answer 0/10046ms16140 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
1Accepted17ms11308 KiB
2Accepted17ms11724 KiB
3Accepted17ms11900 KiB
subtask20/20
4Wrong answer30ms12720 KiB
5Wrong answer37ms13064 KiB
6Accepted23ms12764 KiB
subtask30/30
7Wrong answer17ms12404 KiB
8Wrong answer17ms12376 KiB
9Wrong answer17ms12712 KiB
10Wrong answer18ms13084 KiB
11Wrong answer17ms13288 KiB
subtask40/50
12Wrong answer41ms13956 KiB
13Wrong answer43ms14136 KiB
14Wrong answer41ms14500 KiB
15Wrong answer41ms14588 KiB
16Wrong answer43ms14628 KiB
17Wrong answer41ms14268 KiB
18Wrong answer41ms14436 KiB
19Wrong answer41ms14592 KiB
20Wrong answer43ms14708 KiB
21Wrong answer43ms15044 KiB
22Wrong answer41ms14812 KiB
23Wrong answer41ms14904 KiB
24Wrong answer41ms15120 KiB
25Wrong answer41ms15628 KiB
26Wrong answer41ms15404 KiB
27Wrong answer41ms15392 KiB
28Wrong answer41ms15040 KiB
29Wrong answer41ms15304 KiB
30Wrong answer46ms15204 KiB
31Wrong answer43ms15256 KiB
32Wrong answer41ms15348 KiB
33Wrong answer41ms15376 KiB
34Wrong answer43ms15024 KiB
35Wrong answer41ms15444 KiB
36Wrong answer43ms15708 KiB
37Wrong answer41ms15416 KiB
38Wrong answer41ms15728 KiB
39Wrong answer41ms15216 KiB
40Wrong answer41ms15600 KiB
41Wrong answer41ms15616 KiB
42Wrong answer41ms15512 KiB
43Wrong answer43ms15432 KiB
44Wrong answer41ms15544 KiB
45Wrong answer43ms15564 KiB
46Wrong answer45ms15676 KiB
47Wrong answer41ms15360 KiB
48Wrong answer41ms15504 KiB
49Wrong answer46ms15620 KiB
50Wrong answer43ms15448 KiB
51Wrong answer43ms15740 KiB
52Wrong answer43ms15488 KiB
53Wrong answer43ms15796 KiB
54Wrong answer43ms15680 KiB
55Wrong answer41ms16056 KiB
56Wrong answer41ms16140 KiB
57Wrong answer43ms15896 KiB
58Wrong answer41ms15932 KiB