QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#109246#5108. Prehistoric ProgramsZhaoZiLongTL 875ms6428kbC++141.5kb2023-05-27 23:57:112023-05-27 23:57:15

详细

Test #1:

score: 100
Accepted
time: 875ms
memory: 6428kb

input:

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

output:

41248
4238
13809
5338
27609
48374
389
2458
48749
6754
42979
18533
14096
6986
31692
32583
5803
23456
3405
169
10427
26695
43508
26677
38930
9225
34539
2253
46429
11398
41740
25061
24373
35132
39743
30771
46194
21764
5699
31402
33777
45491
35039
34110
23312
35743
41641
41639
463
7365
9790
6701
23551
3...

result:

ok good plan

Test #2:

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

input:

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

output:

36
13
66
386
966
585
286
257
127
83
39
476
595
814
214
329
907
598
981
427
62
707
662
131
384
793
807
511
379
638
80
271
449
767
869
422
387
327
20
632
474
746
239
502
535
171
473
919
715
88
915
989
334
345
296
168
553
31
975
164
863
820
134
881
33
738
827
17
481
208
177
563
859
667
566
464
98
406
5...

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

2
1

result:

ok good plan

Test #4:

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

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

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

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

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

input:

3
()
(
)

output:

2
1
3

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

4
2
3
1
5

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

1
3
2

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

479
329
311
483
199
232
443
80
297
211
350
265
177
414
253
357
405
239
91
345
45
90
234
420
353
120
356
411
412
227
240
4
362
203
366
205
131
124
86
209
395
210
85
495
214
388
128
130
219
399
83
52
132
62
207
16
410
413
415
136
65
424
427
194
117
79
435
141
437
51
114
242
445
452
248
94
180
459
76
4...

result:

ok good plan

Test #12:

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

input:

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

output:

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

result:

ok good plan

Test #13:

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

input:

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

output:

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

result:

ok good plan

Test #14:

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

input:

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

output:

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

result:

ok good plan

Test #15:

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

input:

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

output:

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

result:

ok good plan

Test #16:

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

input:

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

output:

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

result:

ok good plan

Test #17:

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

input:

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

output:

468
163
390
379
204
396
707
585
590
1
122
4
658
657
601
405
34
274
104
180
79
473
158
149
108
269
730
681
485
504
25
526
571
547
705
218
418
606
530
56
426
166
156
246
494
164
408
382
43
103
230
395
481
55
341
41
131
406
57
224
578
721
475
397
745
427
429
432
709
434
437
13
95
441
442
446
238
450
45...

result:

ok good plan

Test #18:

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

input:

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

output:

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

result:

ok good plan

Test #19:

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

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

input:

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

output:

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

result:

ok good plan

Test #21:

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

input:

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

output:

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

result:

ok good plan

Test #22:

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

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

score: -100
Time Limit Exceeded

input:

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

output:


result: