117362024-11-08 14:54:20redfoxdeltaBob Baba Zárójelsorozatapython3Wrong answer 20/10017ms3424 KiB
N = int(input())
A = [int(i) for i in input().split()]
csuk = 0
z = ''
for i in range(N-1,-1,-1):
    x = A[i]
    if csuk >= x:
        z = '(' * x + z
        csuk -= x
    else:
        z = ')' * x + z
        csuk += x
if csuk == 0:
    print(z)
else:
    print(-1)
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted16ms3056 KiB
2Accepted16ms2872 KiB
3Accepted16ms2872 KiB
subtask220/20
4Accepted16ms3004 KiB
5Accepted16ms3088 KiB
6Accepted16ms3128 KiB
subtask30/30
7Wrong answer17ms2872 KiB
8Wrong answer16ms2872 KiB
9Wrong answer14ms3128 KiB
10Accepted16ms3064 KiB
11Wrong answer16ms3064 KiB
subtask40/50
12Accepted17ms3128 KiB
13Wrong answer17ms3128 KiB
14Wrong answer17ms3152 KiB
15Wrong answer17ms3164 KiB
16Accepted17ms3272 KiB
17Accepted17ms3084 KiB
18Accepted16ms3128 KiB
19Wrong answer16ms3272 KiB
20Wrong answer17ms3128 KiB
21Wrong answer17ms3128 KiB
22Accepted17ms3132 KiB
23Accepted17ms3128 KiB
24Accepted17ms3128 KiB
25Wrong answer16ms3140 KiB
26Wrong answer14ms3048 KiB
27Accepted17ms3252 KiB
28Accepted16ms3128 KiB
29Accepted17ms3320 KiB
30Accepted16ms3320 KiB
31Wrong answer16ms3216 KiB
32Wrong answer16ms3216 KiB
33Accepted16ms3212 KiB
34Accepted17ms3340 KiB
35Accepted16ms3128 KiB
36Wrong answer16ms3128 KiB
37Wrong answer16ms3128 KiB
38Wrong answer17ms3072 KiB
39Wrong answer14ms2980 KiB
40Wrong answer17ms3124 KiB
41Wrong answer17ms3124 KiB
42Wrong answer17ms3424 KiB
43Wrong answer17ms3324 KiB
44Wrong answer16ms3216 KiB
45Wrong answer14ms3180 KiB
46Wrong answer16ms3048 KiB
47Wrong answer17ms3220 KiB
48Wrong answer17ms3128 KiB
49Wrong answer17ms3376 KiB
50Accepted17ms3256 KiB
51Wrong answer17ms3200 KiB
52Wrong answer17ms3216 KiB
53Wrong answer17ms3220 KiB
54Wrong answer17ms3312 KiB
55Wrong answer17ms3136 KiB
56Wrong answer17ms3128 KiB
57Wrong answer16ms3128 KiB
58Wrong answer16ms3128 KiB