97102024-03-02 13:43:56Bandi2134Bob Baba Zárójelsorozatapython3Wrong answer 0/10043ms15296 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
1Accepted17ms11368 KiB
2Accepted17ms11304 KiB
3Accepted17ms11432 KiB
subtask20/20
4Wrong answer29ms12432 KiB
5Wrong answer37ms12608 KiB
6Accepted21ms12244 KiB
subtask30/30
7Wrong answer17ms12060 KiB
8Wrong answer17ms12036 KiB
9Wrong answer19ms12244 KiB
10Wrong answer17ms12292 KiB
11Wrong answer17ms12648 KiB
subtask40/50
12Wrong answer41ms13696 KiB
13Wrong answer43ms13976 KiB
14Wrong answer41ms14224 KiB
15Wrong answer41ms14100 KiB
16Wrong answer41ms14104 KiB
17Wrong answer41ms14076 KiB
18Wrong answer41ms14332 KiB
19Wrong answer41ms14316 KiB
20Wrong answer41ms14504 KiB
21Wrong answer43ms14748 KiB
22Wrong answer41ms14616 KiB
23Wrong answer41ms14760 KiB
24Wrong answer41ms14596 KiB
25Wrong answer41ms14828 KiB
26Wrong answer43ms14908 KiB
27Wrong answer41ms14752 KiB
28Wrong answer41ms15032 KiB
29Wrong answer41ms14968 KiB
30Wrong answer43ms14932 KiB
31Wrong answer43ms14996 KiB
32Wrong answer39ms14856 KiB
33Wrong answer41ms14732 KiB
34Wrong answer41ms14696 KiB
35Wrong answer43ms15252 KiB
36Wrong answer43ms15192 KiB
37Wrong answer43ms14864 KiB
38Wrong answer41ms15088 KiB
39Wrong answer41ms14996 KiB
40Wrong answer41ms15148 KiB
41Wrong answer41ms15220 KiB
42Wrong answer43ms15064 KiB
43Wrong answer43ms15296 KiB
44Wrong answer41ms15224 KiB
45Wrong answer41ms15024 KiB
46Wrong answer43ms15196 KiB
47Wrong answer41ms15200 KiB
48Wrong answer43ms14904 KiB
49Wrong answer43ms14908 KiB
50Wrong answer41ms15056 KiB
51Wrong answer41ms15072 KiB
52Wrong answer43ms14896 KiB
53Wrong answer41ms15000 KiB
54Wrong answer43ms15096 KiB
55Wrong answer41ms15072 KiB
56Wrong answer41ms15144 KiB
57Wrong answer41ms14992 KiB
58Wrong answer41ms15048 KiB