97072024-03-02 13:40:53szellandBob Baba Zárójelsorozatapython3Wrong answer 0/10045ms16244 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
1Accepted18ms11276 KiB
2Accepted18ms11656 KiB
3Accepted17ms11696 KiB
subtask20/20
4Wrong answer30ms12396 KiB
5Wrong answer39ms12880 KiB
6Accepted23ms12144 KiB
subtask30/30
7Wrong answer18ms12428 KiB
8Wrong answer17ms12600 KiB
9Wrong answer17ms12900 KiB
10Wrong answer18ms12932 KiB
11Wrong answer18ms12996 KiB
subtask40/50
12Wrong answer41ms14432 KiB
13Wrong answer41ms14516 KiB
14Wrong answer41ms14756 KiB
15Wrong answer41ms15000 KiB
16Wrong answer41ms14780 KiB
17Wrong answer41ms14848 KiB
18Wrong answer41ms14604 KiB
19Wrong answer43ms14724 KiB
20Wrong answer43ms14916 KiB
21Wrong answer43ms15040 KiB
22Wrong answer43ms14652 KiB
23Wrong answer41ms14868 KiB
24Wrong answer41ms14860 KiB
25Wrong answer43ms14976 KiB
26Wrong answer41ms14792 KiB
27Wrong answer43ms14808 KiB
28Wrong answer41ms14624 KiB
29Wrong answer43ms15000 KiB
30Wrong answer41ms14780 KiB
31Wrong answer41ms14816 KiB
32Wrong answer43ms14812 KiB
33Wrong answer43ms14996 KiB
34Wrong answer41ms14832 KiB
35Wrong answer41ms14968 KiB
36Wrong answer41ms15564 KiB
37Wrong answer41ms15600 KiB
38Wrong answer41ms15656 KiB
39Wrong answer43ms15708 KiB
40Wrong answer43ms15676 KiB
41Wrong answer43ms15576 KiB
42Wrong answer43ms15828 KiB
43Wrong answer43ms15660 KiB
44Wrong answer41ms15652 KiB
45Wrong answer45ms15400 KiB
46Wrong answer43ms15592 KiB
47Wrong answer43ms15796 KiB
48Wrong answer43ms15696 KiB
49Wrong answer43ms15644 KiB
50Wrong answer41ms15984 KiB
51Wrong answer43ms15852 KiB
52Wrong answer43ms15940 KiB
53Wrong answer43ms15892 KiB
54Wrong answer45ms15768 KiB
55Wrong answer41ms15952 KiB
56Wrong answer41ms16012 KiB
57Wrong answer41ms16244 KiB
58Wrong answer43ms16088 KiB