QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#68746#5108. Prehistoric ProgramsHuangHanShengTL 66ms5900kbC++14952b2022-12-19 10:50:012022-12-19 10:50:02

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 66ms
memory: 5900kb

input:

50000
(
(
))))()))()(()))()()()))()(((((()(((()))()(((()))((()(())))))(()(
)
(
)
(((
(
(
(
(
(
()
(
)
(
)((())()((
)))))(
(
)
))
)()
(
)
)
)()(
(
(
()
(
)
(
)()((((())()))())(
(
(
)(
(
(
(()())())
)
)
(
(
(
)((())))((())))))))))((((()()))()))))))))((()())()))
)
)()
)
)
)
)
)
())(())))))()(()((()(())...

output:

13
29
65
69
103
129
133
163
164
172
178
241
307
383
418
506
540
542
586
608
652
687
826
896
919
925
929
969
1021
1031
1060
1093
1141
1170
1334
1491
1677
1689
1753
1767
1911
1946
1978
2004
2087
2135
2170
2216
2238
2321
2380
2420
2472
2540
2551
2560
2665
2724
2735
2743
2768
2812
2892
2933
2937
3064
30...

result:

ok good plan

Test #2:

score: 0
Accepted
time: 6ms
memory: 3584kb

input:

1000
(
))(()))
((((())())))((())(()))(
)(
)
)))
))((()(((((((())()(())()())))(()(())()())))))))((()((()())()())(())))()((()())
)((()()()(())(()))()(())()))(()))))())))))))))))))()))(()()(())(()))())()()))))(())()()()((())(()))(())))))))(()()())()))()())))()()))))))(
)))(((
(
)))()()())))
(
(((())(((...

output:

30
35
45
84
85
112
115
123
128
197
221
297
397
429
433
489
596
617
626
653
762
788
790
879
962
983
1
3
10
12
14
18
22
54
58
64
65
75
77
89
90
92
97
101
104
106
110
122
125
126
135
136
143
147
162
166
178
179
181
182
188
189
190
198
206
209
212
213
215
216
217
223
228
229
242
243
245
247
252
253
265
...

result:

ok good plan

Test #3:

score: 0
Accepted
time: 0ms
memory: 3404kb

input:

2
()
()

output:

1
2

result:

ok good plan

Test #4:

score: 0
Accepted
time: 0ms
memory: 3332kb

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

score: 0
Accepted
time: 2ms
memory: 3344kb

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

score: 0
Accepted
time: 2ms
memory: 3528kb

input:

3
()
(
)

output:

1
2
3

result:

ok good plan

Test #7:

score: 0
Accepted
time: 1ms
memory: 3380kb

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

score: 0
Accepted
time: 3ms
memory: 3404kb

input:

5
))(
(()
)(
(
)

output:

2
4
3
1
5

result:

ok good plan

Test #9:

score: 0
Accepted
time: 2ms
memory: 3520kb

input:

3
((
))())
(

output:

3
1
2

result:

ok good plan

Test #10:

score: 0
Accepted
time: 2ms
memory: 3280kb

input:

6
)
()
()()()
((
)
)

output:

impossible

result:

ok impossible

Test #11:

score: 0
Accepted
time: 4ms
memory: 3484kb

input:

500
(
)
)
(
)(
(
(
)
))(
(
(
(
(
)
)
(
(
)
(
(
)
(
()(()
(
)())
(
(
)
(
)()((
(
)
(
)
)
(
(
(
)
(
(
)
)
)(
(
(
)
)
(
)
(
(
(
)
(
(
())))
(
(
(
)
(
)
)
(
(
)
)
(
(
(
(
(
()
(
(
(
(
(
((
)
(
(
)
(
(
(
)
())
(
(
(
)
(
(
(
)
)
(
)
)
(
)
(
(
(
(
)
(
)
)
)
)
(
)
)))()(
(
)
)
(
)
)(
)
(
)
)
))
(
(
(
(
(
(
...

output:

74
204
304
348
401
438
1
4
6
7
10
11
12
13
16
17
19
20
22
23
24
26
27
29
31
33
36
37
38
40
41
45
46
49
51
52
53
55
56
58
59
60
62
65
66
69
70
71
72
73
75
76
77
78
79
82
83
85
86
87
90
91
92
94
95
96
99
102
104
105
106
107
109
114
117
120
124
128
129
130
131
132
133
136
139
141
143
149
152
153
156
15...

result:

ok good plan

Test #12:

score: 0
Accepted
time: 0ms
memory: 3312kb

input:

50
)
)
((((()())())))(())(())
()(((()))
(((()))(()
()(((
))
)
)()))(()(()())(((((()
(
)
)
)((
)()((
())()))
(())))()
(((
))))(()
()(())(()))())()
)
)
(
(
(
(
((())()())())))(((())
()(
(()(())()((()
()(((()())))())()(
)
)((()
(
)
((
)
()(
(
(
)
)))((())
)
()))()(((()(()
((
((()))(())(()())(()())())()...

output:

3
4
10
22
23
24
25
27
32
36
37
38
5
34
43
6
17
28
29
13
14
31
46
42
9
45
26
44
50
18
40
47
49
15
48
19
16
7
41
39
35
33
30
21
20
12
11
8
2
1

result:

ok good plan

Test #13:

score: 0
Accepted
time: 4ms
memory: 3440kb

input:

50
)
(
)()(
())(
()()(((((())(
)(())(()((())(()(()))(())())))))(())()))()())))))()(()()))(())))(()(((())(())()((())())()())(())())))()((()(()(())((()()))))()((((())()())((()))))((()()(())))))(()(())(()(()((())(()(())((()())))())(()))()())))()()((((()()((()()))((())())))()(())((()()((()((())())(()(()...

output:

15
33
2
8
13
16
18
28
40
41
46
47
11
5
26
3
4
10
19
42
44
37
29
21
6
31
23
12
36
17
39
50
49
48
45
43
38
35
34
32
30
27
25
24
22
20
14
9
7
1

result:

ok good plan

Test #14:

score: 0
Accepted
time: 6ms
memory: 3440kb

input:

150
))(()))(())(())))()))())()()()(())(((())))()))))()
)))()(()()(()((())())))(()(()(())((())))(((()(((())()()())))()())(((((((()))((())((())(())())(()))()(()()()()((((()))(()())))()(()((()(()(((((()((()())()))((((()))()))(()(((()()(((()(((()(((())(())())(()((()))))))()())((()(())())))((()()(()(((()...

output:

20
48
53
103
130
136
4
6
15
32
35
37
40
49
52
73
79
92
94
100
104
111
140
141
143
149
11
14
38
60
69
84
87
106
7
28
148
120
12
24
98
142
105
17
5
96
117
129
137
10
16
133
27
51
70
23
62
91
135
61
89
93
77
147
29
102
122
9
3
2
25
125
41
115
86
43
47
18
56
134
150
59
85
45
30
19
55
21
33
8
121
126
71
...

result:

ok good plan

Test #15:

score: 0
Accepted
time: 0ms
memory: 3360kb

input:

150
)))(
(()
(())((())))(()))()(()
((((()(((()))()(((((())()(()()((((()))((((()(())()(()))(()(())())(())(())))(((()))(())()))()((())((()(()(())())))))()(((()(()()())()))))()))(()(()()()(()(())()))))()))(((((())(()())((()()((((()))))(())())(())(())((()()(())))((((())((((()))()))()))))))))()())))))
(
...

output:

4
15
42
66
2
5
8
10
14
26
36
37
44
46
52
56
58
61
87
89
94
118
127
128
141
19
51
64
86
98
104
148
32
70
121
150
100
142
149
49
129
18
50
80
113
84
102
107
117
55
75
145
112
16
29
23
76
114
136
53
34
82
63
74
39
90
88
144
85
21
13
140
7
41
62
45
40
111
96
97
79
81
116
139
20
108
78
125
137
130
122
12...

result:

ok good plan

Test #16:

score: 0
Accepted
time: 4ms
memory: 3392kb

input:

150
)()((
)
)))())))
)()())((()(()())((())()))(()))(())((((((((()()(())())(()(((()))())()((()((())())))))))()((()))))((()(((()(((((()))()))((()((()()))(())))))()))))()())()()())(())(())(()))())((((((()()()))()((((()))))))((())()))()(()((()(())(())(())()())(())
()()
)
(())()))(())(()((())()()())())((...

output:

5
68
89
98
8
30
36
48
55
58
60
65
67
74
81
93
97
99
106
108
110
111
118
123
136
149
52
75
92
122
130
140
45
117
27
115
84
131
50
129
9
19
26
57
124
1
11
31
56
24
70
42
46
88
100
127
63
14
91
128
119
82
146
120
35
101
15
114
37
107
133
43
32
78
90
12
44
61
112
7
64
109
125
85
72
144
41
22
20
95
28
16...

result:

ok good plan

Test #17:

score: 0
Accepted
time: 7ms
memory: 3412kb

input:

750
(()()((()((((())()((()))()()))()))(()()(()))(()(())()))((((((
)))))))
)
((()()()(())((()(()())(())(((()((((()))(()(())((())(()())(())())))())))()(())()))((()(()((((()(()))(()())()((()()()))))(())())(())())())()((()(
)
)
(
)()(((()(())))()))))(((((((()))()()()(()())))(()())(()((
(
)
)(()))
((())(...

output:

19
58
80
105
197
252
276
297
332
360
391
414
425
489
516
554
572
591
671
750
7
9
13
16
17
20
21
22
27
37
45
48
57
62
65
66
67
69
74
81
82
95
97
101
112
116
121
136
138
141
148
150
152
155
157
159
160
162
169
172
175
176
181
182
184
185
186
191
195
208
212
213
214
220
224
225
227
228
229
231
238
243
...

result:

ok good plan

Test #18:

score: 0
Accepted
time: 4ms
memory: 3456kb

input:

100
)
)
)
(
)
(
))))()
)
(
(
(
(
)
)
)
)
(
(
(
(
())
(
)
)
)((
)
(
(
(
)
(
(
)
)
)
)
()((
(
)
)
)
)(((
((((
(
)
(
)
((
)
(
(
)
(
())(()))
)
)
(
)
(
(
(
(
)))()()
)
(
(
(
(
)
(
)
)
)
(
)
)
)
)
(
)
(
(
)
(
)
(
(
(
)
)
(
)
)
(
)((((
)
)
()((()()(()))))
)
(

output:

4
6
9
10
11
12
17
18
19
20
22
27
28
29
31
32
38
44
46
50
51
53
57
59
60
61
62
65
66
67
68
70
74
79
81
82
84
86
87
88
91
94
100
37
48
43
25
42
95
7
63
54
99
98
97
96
93
92
90
89
85
83
80
78
77
76
75
73
72
71
69
64
58
56
55
52
49
47
45
41
40
39
36
35
34
33
30
26
24
23
21
16
15
14
13
8
5
3
2
1

result:

ok good plan

Test #19:

score: 0
Accepted
time: 1ms
memory: 3392kb

input:

100
)
()(
(
)
(
)
(
(
)
)
)(()
)
)))
)
)
(
(
(
)
(
(
)
(
)
(
(
(
))(
(
(
))((
(
)
(
))())
)
(()
)
)
(
)
(
(
)
)
(
)
(
))
(
(
)
)
(
)
)
)
)
(
())
)
(
(
)
)
(
)
(
))
(
)
)
(
(
(((
(
(
(()
)
)()())(()((()((())
(
)
)
(
(
)
)
(
)
(
)
(
))(
)
(
(
(
)
(
(((())

output:

impossible

result:

ok impossible

Test #20:

score: 0
Accepted
time: 3ms
memory: 3456kb

input:

100
)
)
()))((((
))()
(
(
(
)
(
)
(
(
)
()
(
(
)
)
(
)
(
(
)
)
)
(
)
)
(
(
)
)
(
)
)
)
)
(
(
)
((
(
(
)
)
(
(
)
(
)
(()((
)
(
)
)
(()))()()())))()()((
(
)
)
(
(
(
)
)
(
(
)
(
(
(
)
(
(
)
)(
(
)
)
)
(
(())())(()
)
)
(
()
((
(
)
)
)
)
(
)
(
(
)
)
(
())
)(

output:

14
85
5
6
7
9
11
12
15
16
19
21
22
26
29
30
33
38
39
42
43
46
47
49
53
57
60
61
62
65
66
68
69
70
72
73
76
80
84
87
92
94
95
98
41
86
51
75
81
100
3
56
4
99
97
96
93
91
90
89
88
83
82
79
78
77
74
71
67
64
63
59
58
55
54
52
50
48
45
44
40
37
36
35
34
32
31
28
27
25
24
23
20
18
17
13
10
8
2
1

result:

ok good plan

Test #21:

score: 0
Accepted
time: 4ms
memory: 3348kb

input:

100
(
(
)
(
)
(
(
(
(
)
)
)
)
()
)(
)
)
(
(
)
(
(
)
)
)
(
)
(
(
))))
(
)
(
)
(
(
(
()()(
)
())
(
(
)
)
(
(
)
(
(
)
)
(
(
(
(
(
)
(
(
(((
)
)
)
))))
(
))(
)
)
()
())()
)
)
(
)))
(
)((()))(
(
(((
((
(
)
(
(
)
(
)
)
()
)()
)
)
()))()(
)(())(
)
(
(
(
(
)(
)

output:

14
69
88
1
2
4
6
7
8
9
18
19
21
22
26
28
29
31
33
35
36
37
38
41
42
45
46
48
49
52
53
54
55
56
58
59
65
73
75
77
80
82
83
85
95
96
97
98
79
60
78
15
76
93
99
92
66
64
30
74
100
94
91
90
89
87
86
84
81
72
71
70
68
67
63
62
61
57
51
50
47
44
43
40
39
34
32
27
25
24
23
20
17
16
13
12
11
10
5
3

result:

ok good plan

Test #22:

score: 0
Accepted
time: 3ms
memory: 3528kb

input:

1000
(())())()(((())()())(((()(()))((()((((()())))())))))(()(()((())(((()))()(()
)
(
)
()
)
)((()))))
)
((((((()))()())))))((()(
((
()(()())))(()
)()
(
((
(
)
)
)(()
)))(
)
))
(
(()))))
)(())(((())((((
)
)
(
(
())))(())
(((
(
(((
())()(
()())
)
)
)
(
))))())(
)
))(
)
())(()(()))))()(()((())((((()())...

output:

impossible

result:

ok impossible

Test #23:

score: 0
Accepted
time: 2ms
memory: 3456kb

input:

1000
))(()))
(
)))(
)
((
()))()))))()()(
))))((((((((()()(())((()()
(
)
)()(()
(
()))))()
(
(()(()(((()())(((((((())()()())())(())()))))((()((())((((((()(()()
)(()())((()))
(((
)
)
(
)((
(
(
)
(
)
()(())(((
(
)
(
(
)
()(()(()()(()()((()))())((()())))))((())(((()()(())(()()())(()()(((())()(()((((((((...

output:

impossible

result:

ok impossible

Test #24:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

4000
(
)
))
)()))))(
(
)
(
)
)
)
)((()((
(
)
)()(
)
)
)
)
(
)
(
)
)
(
()))((()))))()((()(
(
)))
(
)
(
(
(
(
)
)()(()()(()()))))())
)
)
)(((
)
)
)
)
(
(
)
))()()))((())
(
(
)
(
))(
(
)
)
(
)
)
())(
)
(
(
(
)
())))(())((()(()()((()((
(
)
)
(
)
)
)
)
)
)
)
)
(
)
(()))))(
)
)
(
())))(((())()(
(
(
()(
(
...

output:

impossible

result:

ok impossible

Test #25:

score: -100
Time Limit Exceeded

input:

1000000
)
(
)()(((()))(
(
(
(
)
(
(
)
)
(((())((()(()((())
(
)
)(
)
)
))))(()))()())(()((()))(()()()))()()()))))))))(())))((((()(()()))((((((()((((()()(
)
((
)
)
(
)
())()()((
)
)))(())((()))((()()))(()(())())))())))())))(()()(
(
()(
(
(
()()
)
))
)
(
(
(
)
)
)
(
)
(
)
)
)
)(()))()))
(
)
)))
(
)
(
(...

output:

32
215
326
405
435
460
537
538
669
711
797
870
934
960
1099
1204
1327
1350
1352
1379
1387
1405
1406
1493
1547
1664
1687
1869
1944
1956
2071
2098
2111
2174
2207
2208
2227
2242
2243
2315
2391
2422
2431
2457
2507
2576
2630
2723
2871
2972
2977
3076
3140
3157
3183
3204
3214
3240
3288
3307
3314
3377
3490
...

result: