QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96683#5108. Prehistoric ProgramsmarcoskAC ✓274ms22756kbC++23951b2023-04-15 02:54:412023-04-15 02:54:43

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-15 02:54:43]
  • 评测
  • 测评结果:AC
  • 用时:274ms
  • 内存:22756kb
  • [2023-04-15 02:54:41]
  • 提交

answer

#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(s) int(s.size())
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;

const int MAXN=1e6+10;
int s[MAXN],m[MAXN];

int cmp(int i, int j){
	if((s[i]>=0) != (s[j]>=0)) return s[i]>=0;
	int me=min(m[i],s[i]+m[j]);
	int he=min(m[j],s[j]+m[i]);
	return me>he;
}

int main(){FIN;
	int n; cin>>n;
	fore(i,0,n){
		string t; cin>>t;
		for(auto x:t){
			s[i]+=x=='('?1:-1;
			m[i]=min(m[i],s[i]);
		}
	}
	
	vector<int> id(n);
	fore(i,0,n) id[i]=i;
	sort(ALL(id),cmp);
	
	int sum=0,mn=0,bad=0;
	for(auto i:id){
		if(sum+m[i]<0) bad=1;
		sum+=s[i];
	}
	bad|=sum!=0;
	
	if(bad)cout<<"impossible\n";
	else{
		for(auto x:id)cout<<x+1<<" ";cout<<"\n";
	}
	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 13ms
memory: 3740kb

input:

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

output:

26700 26740 26738 26737 26729 26727 26724 26723 26716 26715 26714 26713 26711 26709 26703 26744 26698 26696 26695 26693 26692 26689 26685 26682 26679 26677 26674 26672 26671 26670 26779 26819 26817 26815 26813 26810 26809 26806 26803 26802 26800 26792 26787 26784 26783 26668 26778 26777 26776 26773 ...

result:

ok good plan

Test #2:

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

input:

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

output:

934 575 576 258 257 929 577 253 252 584 933 265 247 585 245 243 242 935 239 590 595 596 280 291 290 554 557 287 286 560 561 282 562 598 563 564 925 566 570 271 268 267 573 948 945 820 198 819 626 628 947 190 189 188 619 632 636 182 181 638 179 178 177 640 814 215 229 228 604 827 826 223 825 611 217 ...

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

1 2 

result:

ok good plan

Test #4:

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

input:

2
((
))

output:

1 2 

result:

ok good plan

Test #5:

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

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

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

input:

3
()
(
)

output:

1 2 3 

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2 1 3 

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

2 4 3 1 5 

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

1 3 2 

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

204 414 211 210 209 208 207 415 205 413 203 416 199 198 196 420 194 192 404 398 234 399 232 401 228 227 226 191 405 406 219 409 410 411 412 214 157 436 437 438 439 440 160 159 158 166 156 442 153 152 443 149 445 143 429 424 186 426 184 427 182 428 180 395 178 177 176 431 171 434 435 362 318 315 356 ...

result:

ok good plan

Test #12:

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

input:

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

output:

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

result:

ok good plan

Test #13:

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

input:

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

output:

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

result:

ok good plan

Test #14:

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

input:

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

output:

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

result:

ok good plan

Test #15:

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

input:

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

output:

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

result:

ok good plan

Test #16:

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

input:

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

output:

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

result:

ok good plan

Test #17:

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

input:

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

output:

360 606 379 378 1 609 374 371 369 368 612 362 361 382 358 357 618 348 622 345 624 343 341 625 338 397 418 417 414 409 408 407 406 405 601 401 400 335 750 395 394 392 391 390 387 605 385 384 383 664 658 265 264 263 259 258 661 255 252 250 663 657 246 665 243 668 238 669 671 231 230 229 228 297 333 33...

result:

ok good plan

Test #18:

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

input:

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

output:

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

result:

ok good plan

Test #19:

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

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

input:

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

output:

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

result:

ok good plan

Test #21:

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

input:

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

output:

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

result:

ok good plan

Test #22:

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

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

score: 0
Accepted
time: 232ms
memory: 14864kb

input:

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

output:

541083 541063 541066 541070 541071 541072 541073 541075 541077 541082 541062 541084 541085 541087 541088 541093 541094 541097 541104 541108 541046 541031 541032 541035 541038 541039 541041 541042 541044 541045 541109 541051 541052 541053 541054 541055 541057 541058 541060 541162 541148 541150 541153...

result:

ok good plan

Test #26:

score: 0
Accepted
time: 26ms
memory: 20460kb

input:

1
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...

output:

impossible

result:

ok impossible

Test #27:

score: 0
Accepted
time: 22ms
memory: 21104kb

input:

1
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))...

output:

impossible

result:

ok impossible

Test #28:

score: 0
Accepted
time: 16ms
memory: 20240kb

input:

1
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...

output:

1 

result:

ok good plan

Test #29:

score: 0
Accepted
time: 26ms
memory: 20552kb

input:

1
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...

output:

impossible

result:

ok impossible

Test #30:

score: 0
Accepted
time: 12ms
memory: 20908kb

input:

1
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...

output:

impossible

result:

ok impossible

Test #31:

score: 0
Accepted
time: 18ms
memory: 15760kb

input:

2
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))...

output:

2 1 

result:

ok good plan

Test #32:

score: 0
Accepted
time: 23ms
memory: 14776kb

input:

2
)()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(...

output:

impossible

result:

ok impossible

Test #33:

score: 0
Accepted
time: 12ms
memory: 20744kb

input:

3
)()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(...

output:

3 1 2 

result:

ok good plan

Test #34:

score: 0
Accepted
time: 121ms
memory: 14712kb

input:

1000000
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((...

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 113ms
memory: 14584kb

input:

1000000
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))...

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 186ms
memory: 14740kb

input:

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

output:

555562 555542 555544 555546 555548 555550 555552 555554 555556 555558 555560 555540 555564 555566 555568 555570 555572 555574 555576 555578 555580 555520 555502 555504 555506 555508 555510 555512 555514 555516 555518 555582 555522 555524 555526 555528 555530 555532 555534 555536 555538 555644 555624...

result:

ok good plan

Test #37:

score: 0
Accepted
time: 177ms
memory: 22756kb

input:

999999
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)...

output:

666672 666657 666658 666659 666660 666661 666662 666663 666664 666665 666666 666667 666668 666669 666670 666671 666656 666673 666674 666675 666676 666677 666678 666679 666680 666681 666682 666683 666684 666685 666686 666641 666626 666627 666628 666629 666630 666631 666632 666633 666634 666635 666636...

result:

ok good plan

Test #38:

score: 0
Accepted
time: 264ms
memory: 14680kb

input:

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

output:

267506 576239 267524 576241 576243 576244 576253 576254 267514 576262 576264 576238 267505 576277 576278 267502 576281 267499 267498 267497 267495 576218 576194 576197 267550 576206 576211 576216 267543 576217 267541 576284 267539 576220 267537 576222 267533 576233 267529 576235 576236 267447 267463...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 274ms
memory: 14568kb

input:

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

output:

621466 621454 238821 238820 621457 621459 238817 238816 621460 238814 621465 238823 238810 238809 621469 621470 621471 238805 621472 621475 621486 621445 621425 621428 238844 621429 621438 621439 621443 238837 621444 621487 621446 621447 621448 238831 238830 238829 621451 238825 621453 238756 621526...

result:

ok good plan

Test #40:

score: 0
Accepted
time: 60ms
memory: 3604kb

input:

564
)())((())((()))))(()())((((()()(()(()))(()((((()()))(((()))(()()()(()((()()()()((()))))((())))()(()((())(()())))))))())))(((())()()()))))()((((()()))()(()()())))(()()(())((())((()())(()()())()(((()))()())())))(((()(((((()())()())))()()((())))()()()(()()))()(()()()(((())())))(()(()(()((())()((()(...

output:

358 253 537 163 542 469 236 108 287 305 367 360 307 93 359 243 528 329 65 17 541 563 267 134 445 105 95 100 75 356 513 465 302 514 113 26 44 342 555 405 54 281 265 531 547 139 133 153 340 286 301 421 11 52 451 350 299 32 483 463 408 255 24 330 533 235 81 529 553 327 223 43 137 443 510 552 373 49 280...

result:

ok good plan

Test #41:

score: 0
Accepted
time: 50ms
memory: 4068kb

input:

109
)(()((())()(())())))))((()(((()((()()())))()))()()()()))(()(()()((()()())())()))())(((()()))(()))))(()((()((()()(((()))()((((()(()()()(()))))))))())((())(())()((()))))((())()()())))))(())))())()())))())()(()))))(())()(((()((((()))))((()())()())())))())((()(()())()())((((()()(()((()))(())((()((()...

output:

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

result:

ok good plan

Test #42:

score: 0
Accepted
time: 64ms
memory: 3964kb

input:

64026
)()()()))((())((()(())())(()()())))(())))()))()(((())())))()))(()(()())((())((()(()))))()))())()(()(()))))())))(()()()()(((((()()()))))))((((()(()(())()))((()))))()())())(()(((()))))()))())))(()()()(())))((((())(())())(()()))()))))(())))()(((())()()()())()))))(())()(()(((())(()()()()((()()((()...

output:

47015 28695 14757 58176 32474 5042 31752 22368 26926 58191 43057 47018 25499 14761 19976 34426 44084 28697 47013 22378 19968 40837 31758 58213 58214 32848 27812 9673 43069 44077 52881 52880 58140 18125 14748 19983 47029 58144 58147 9637 9638 33947 19961 9641 48834 14751 34424 5059 58155 40815 52862 ...

result:

ok good plan

Test #43:

score: 0
Accepted
time: 222ms
memory: 11676kb

input:

741507
)))((())))))()))(()()())((()((
))())
()
)(((()))()((()()(()())(())(((
(()))())()))))((
))(
)()
((()((()()()))(
(()(
(()())())(
)
)
(((()()(()(
()()(((
)(())))((((()((()()))))(()())(()))())((()((()((((()))()()(
()))
())())())))(()))(
())))()(
)(
(())()()())()())()((()))(
(())
)))()()
)
)(())()...

output:

349882 670225 156631 349899 582093 156636 349892 349891 349888 156640 349887 349885 670217 156646 156629 670216 582097 156653 156654 156655 670214 349876 156658 349875 582102 349873 349871 582091 670243 349940 670241 582083 582084 156601 156602 670238 156605 349925 349916 349912 670232 156664 156615...

result:

ok good plan

Test #44:

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

input:

32
())((())(()(((())())()())((())(()(((((((()))()(())))))())(())))((())((((()))(()(()(()(()))()(())())((()())(()((((((()(()(()()(()))()(())(()(()()))()())))()((()()(()(())))((()(()(()))))())()()(())(())(())()))(((()((((()())(()()()()()())()())())((()(()(()()
()
()))()()()(()())()((())))()((()()(()()...

output:

25 23 7 17 1 21 32 22 11 6 2 3 10 24 27 8 15 14 29 31 26 9 20 19 4 30 18 16 5 12 13 28 

result:

ok good plan

Test #45:

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

input:

8
())(()()))))()(()))))()()(()()(())))((())))))(((())))))())((((()))((()))((())))()()))()(())(()(()()()(()())()(()((())()))(((((()(((()((()()((()()(())(()())()((()))))())()())(()))())(((((((()())(())))(()))))(())(())(()))))))(()(((()((()((((()))(()(((()))()))()())(((()))(((())(())))))(((())()()()))(...

output:

6 3 7 2 1 4 5 8 

result:

ok good plan

Test #46:

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

input:

32
()))()(()))()()()()()(())((()()(()))(()
(()())())()))()(())())))()(()())()((()(()(()))()(()((((((((()))()))))((((())()))()((((()))((())()(()(()((()()()))))()()())()()((()(()()(((()))()))((()(()()(((()((())((((((((()())()(((()(()))(
)))()()()((())()()
())))((()))(()(((()((()()()))(()
)((()))))()))...

output:

23 29 27 14 31 8 4 28 2 21 17 13 32 6 26 10 20 7 19 15 22 24 1 18 3 11 9 12 25 16 5 30 

result:

ok good plan

Test #47:

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

input:

53
))(((((())))))))((()()())()))())())())())(())())(())())(((()((()())(()(())))())(((
()()))((())))()))()(())))()))()(()(())))((())((((((()))()(()))))))))((()))))))))((())()))(()))())()()(()))()())()())())()(())(((()(
)())
()))))()))()(()()))()))(()((((()))(()))())(((()))(()()()))(())))(())))()(((((...

output:

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

result:

ok good plan

Test #48:

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

input:

25
)()((()())()))())))(((())))(())(()))))(()(()))((()()())(()((()())))(())())())())((()((()()(())))))))()((())())(()()(()()()())()())(()((()())(((())))()))(())()()()()((()))()(((())(())())((()((()))))(()(((()(())()()(((()))(()())(()))((())()))()))())(((()))))()()()((())((())()))()(())()(((((()())(((...

output:

25 21 5 11 19 14 9 12 20 7 13 22 1 15 4 16 8 6 24 17 23 10 2 18 3 

result:

ok good plan

Test #49:

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

input:

90
))))((()()()))())))(
()())((((())))()))((())()()))))())(()()()(()))())))))((())())))()))(()())((())()(())))((((()(()()()())))()()))()(()())))())(((
))))())))()))))()((()(())(()((())(())()(()())))))()((()))((()()(()())()((()())((()()(()()(())())())()()(()))((()((()()(()()(()((()()()()))(())))))())...

output:

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

result:

ok good plan

Test #50:

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

input:

16
))))))(((()(())()()(()((()()((())(()()(())))((())))))))(())(()))()((())((()(()()))())((())))()()()((()()))(((()()))()()))))()())))()))(((((()))(()()((()(()()()((((((()()(((((()(())))())()(())()())()(()(())()))()()()))(()(()))(())))(()))(((())))((((((()))(()((((())()())()(())()))()))(())()))))())(...

output:

3 5 6 10 9 1 11 14 12 16 2 7 13 15 8 4 

result:

ok good plan

Test #51:

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

input:

28
(())((()(()
(()))())()()()()(())()()(()
(()()))()))()))()((()()()()))()((()))))))())))(()))))(())())()()(()(((((((()((())))(()))(())))())(((())))))))))))))))))))))))))))))))))))))))))))))))
)())())((((()((()()(()(()
)(()()((()((())((()()))())
(((()((((()())((((()())(())))())(()))))))((())()))))()...

output:

28 23 18 17 1 11 27 26 25 9 5 16 4 10 14 13 19 12 20 6 24 15 22 7 2 21 8 3 

result:

ok good plan

Test #52:

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

input:

14
))(())()((((()((()((()(()))))())))((()()((())(((()))(())))((())(())(()(()(())(
(()()())(()(())(()()))))))))())())()))())))())()(()))())))())(((())()(((((()())(()())()(()
()))))()((()()()(()())(())()(((()))()())((((()(()()())))(()))(()()()())(())())())))()))((()())()))(((((()()((()(()))()()))()()(...

output:

12 13 14 7 1 6 3 8 4 2 5 9 10 11 

result:

ok good plan

Test #53:

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

input:

3711
(
)(
)(
(
)(()
((
(
(
))
(
))())
(
)((
)
)
))))
)
)
(
)
((
(
)((
()
(
(
()))
()(()
)(()((
)
(
)
)((
)))))
(
)(
)(((
)((((((
)
((
()()()(((
)
)()
)(
)()())
(
((
(((
)
(
)(
)
)(
((
)(()
)
(
(()())))))(
(
(
()(
())
(
)((
)
()(
)
)((
()
(
)
)())
)(
()(
)(
)
)))))(
)(
(
()()
(
)))(((
)
)(()()(
(
(()...

output:

1158 2457 2458 1170 1169 2460 2461 1166 2462 2465 1162 2466 1160 2456 1157 2472 2475 1153 2482 2484 2485 2488 1147 1146 1145 2489 1186 1203 1202 2432 2434 1199 2436 2437 2438 2441 1192 1190 1188 2493 1185 1184 2447 1182 2451 1180 1179 1178 2452 2453 1175 1174 2557 2529 2530 1107 2531 2532 2535 2538 ...

result:

ok good plan

Test #54:

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

input:

7863
(
)
)
)
)
))
(
(
(
)
)
(
(
)
((
(
)
)
(
(
)
(
(
(
)
(
)
)
)
)
(
)
(
)
)
)
(
(
)
)
)
)
(
((
(
)
((
(
)
))
(
)
((
(
)
(
)
(
(
(
(
(
)
)
(
)
(
()
)
)
(
(
)
)
(
)
)
(
(
)
)
)
(
)
))
(
)
)
)
)
(
(
(
(
(
(
)
(
(
)
)
(
)
(
(
)
(
(
()
)
(
)
)
)
(
(
)
)
)
(
((
(
)
)(
()
)
)
)(
(
)
)
)
)
(
)
(
(
)
(
(
)
...

output:

3269 6331 3280 6333 6334 6336 6339 3271 3270 6330 3268 6340 3266 6341 6342 3261 3260 3259 3295 3304 6321 6322 3301 3300 6323 3297 3296 3256 3294 3293 3291 3290 3287 3285 3284 6329 3219 6360 3228 3227 6362 3223 3222 3221 6364 6359 3217 6366 3215 6367 6368 3212 6370 6371 6351 3254 3253 3251 3250 3249 ...

result:

ok good plan

Test #55:

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

input:

2272
)
)
(
)
)
(()()
(
))()((()((
)
()(
))
))
(
)((
()
)(((
(()))()
))(((((
)
)
)()((((
(()(((
)())()
()(()
)(
)()(((
()
(((
))
))
()
(
(
()
)
(
(
(
((((()()((()
((
)
(
)
)((
)((
)((
((
((
(
((
(
())
)
(
()
(
)()(())
)
())(
(())()
(())((
))
)()()())
(()))(
()
(
)(
())
())()((
)((
))
((((
(()(
))()()...

output:

1222 1251 1247 1246 1244 1243 1239 1238 1236 1233 1226 1253 1220 1217 1215 1211 1202 1201 1200 1199 1198 1281 1302 1301 1300 1299 1298 1297 1291 1288 1286 1283 1187 1277 1276 1273 1271 1269 1268 1265 1259 1257 1119 1146 1145 1143 1141 1136 1134 1132 1127 1126 1120 1149 1118 1117 1112 1108 1107 1106 ...

result:

ok good plan

Test #56:

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

input:

4127
)
)(
)
(
)
)
()(
)
)(
(
)
))
)())
((
((
)()(
(
(
(
)
)
((())
(
(
(
)(
)((
)((
)()
)
))
(
(
)
(
)
)
(
(
)
((
((
()
(
())
(
(
))
(
(
(
(
()
)
())
)(
))
)
(
))
)(
)
(((
(
)
)
(
()
)(
)
(
(
(
)
(
((
(
)))
(
(
)(
(((
)(
())
)
()
)
)
)
)
()((
()
)()
(
(
(
(
(
)
)(
(
)()
)
)
(
(
()(((
()
))
((
()
)
)
...

output:

2804 2772 2774 1332 2776 2779 1329 1328 2781 2786 2791 2794 2798 1321 1320 2800 2770 1316 2805 2806 1313 1312 1311 1310 1309 1307 2810 2811 2812 2815 1301 1354 1369 1368 2726 1365 2728 1363 1362 2731 2733 1359 2735 2737 1356 2741 2818 2743 1352 1351 1349 2746 2748 2752 1344 2758 2766 1340 2767 2768 ...

result:

ok good plan

Test #57:

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

input:

5314
)
)
((
(
(
)
)()
)
(
)
)))
(((()(
)
()(
())
)
(
(
()
)))
)
)(
()
(
(
()(
(
(
))
(())
)((
))
(
))
)(
(
(
(
(((
(
((
(
)
(
((
(
)
))(
)
))
(
)
))(
(
(
)))
))
(
)(
(
(((
)))
(())((
)(
())(
(
()
()
(
(
(
)(
)
(
)
)
))
(()
)()
()
(
(
(
())
()(
)
(
)
(
(
(
(
)
)(
)()(
)
)
)(
)
)
(
(
)(
((
)()
))
)
(
...

output:

4456 4466 2000 4463 3410 4461 4460 2007 4459 3876 3408 3412 2012 3407 3406 3877 3404 2017 2018 4450 2022 2023 3414 4480 4478 1969 1970 1971 1972 1973 1975 4477 1977 4449 1979 1980 1981 4475 4474 1986 4473 3875 4471 4468 2065 2053 2054 2055 4437 4436 3396 2060 2061 4433 2064 2052 3881 4431 2069 4430 ...

result:

ok good plan

Test #58:

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

input:

3465
(
)
)
(()
(
)()
(
(
)
)
)((
)((
(
)
)))
((
)
)
)(()
(
((
)
)(
(((((
(
)
(
))(
(
(()
))()(
)
))
(
(
(
))
)(
(
((
(
(
)
)
(
)
)
(
)
())
(
(
((
)
)(
)
(
)
)()((
(
)(
)))
(
)
)
(((
)
))(
()
)))
)))
(
(
)
)
)
)()))
)
((
(((()
)
)
)
)
(
))(
)
(
)
)
))(()((
()
)))
(
(
(
)
)(
(
)((((
)()
)
)
(
))((
())...

output:

1933 1066 1926 3044 1927 3046 1929 1930 1059 1058 1057 2705 2704 1067 2703 1935 3051 1936 1937 1938 1939 1941 1045 1044 1942 3036 2713 1093 1914 1090 1089 1088 1087 1086 1085 3034 1082 3053 2711 3038 1077 2710 1919 1920 1072 1071 1923 2707 3042 1003 1954 1015 3066 1956 3068 1011 1010 1009 1008 1006 ...

result:

ok good plan

Test #59:

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

input:

3992
)())(()(
((
))
((())
(())
)()
)
()(
(
)
(
((
(
)()
(
()))
)((
())
(
)
()
(
(()))
)(
((
(
)
(())(
((
))
((
)
)
)
)
())
(
(((
(
()
)
()))(()
(
)(
))
(
(()(
()
(
)
()))
)(
)(
())))(
)())
(
))
(
(((
)
))
(
(
)((
()
)
(((
)
(
))
)
()
(
)
(
(((((
(
)
((()()((())
))
(
()()
)(
(
)(
)(
(
(
)
)(())(
)(((...

output:

2172 2161 2162 2163 2166 2167 2168 2169 2170 2171 2159 2173 2175 2176 2178 2180 2182 2186 2188 2189 2149 2126 2127 2128 2130 2133 2135 2142 2143 2145 2190 2150 2151 2152 2153 2154 2155 2156 2158 2244 2230 2231 2233 2237 2238 2239 2240 2242 2243 2229 2253 2257 2260 2262 2263 2266 2267 2268 2208 2191 ...

result:

ok good plan

Test #60:

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

input:

127
)))()())))))))()((
))((()(((
))(()((())))((()()(((()(()(()(()()(((())(())())(())
)()((())()(())))()))())()(()()))
))((()())((((((
()()()((
(())(()((()((()(()))())(((())())())))())(()(
)(()))))()))()(((()(()()()()()()))(
)((())())
()(()()(()(())))())())))))))
)()))()(())())()))))())
((()))))))()(...

output:

69 102 98 105 106 22 97 110 73 122 68 7 6 66 125 95 77 86 87 84 35 36 55 71 65 56 27 113 112 14 18 94 3 78 5 2 74 91 72 118 63 64 124 70 107 103 96 90 93 75 44 28 67 45 43 42 100 40 61 23 24 34 80 119 120 13 83 88 41 114 54 19 53 21 32 60 59 85 104 17 8 81 30 12 26 101 99 57 37 1 49 50 126 58 20 62 ...

result:

ok good plan

Test #61:

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

input:

7074
(
(
)
(
(
(
(
)
)
)
(
)
)
(
)
)
(
(
(
(
)
(
)
)
)
(
(
)
)
))
(
(
)
)
(
(
(
(
(
(
(
)
)
)
)
(
)
(
)
(
)
)
(
)
(
)
()
)
(
)
(
)
(
(
(
)
)
)
(
)
(
(
)
)
)
(
)
(
(
)
)
(
(
(
(
)
)
)
((
)
(
()
)
)
)
)
(
(
(
)
(
)
((
)
)
)
(
(
(
(
(
)
)
(
(
(
(
)
)
(
(
(
(
(
)
(
)
(
)
)
(
)
(
(
(
(
(
(
)
)
(
)
)
)
)
...

output:

5628 5645 5644 2894 5642 5640 2899 5637 5636 2905 2911 2912 2913 2914 5630 2916 2891 2919 2920 2921 2922 2923 2925 2926 2927 2931 5623 2935 5620 2939 2941 2942 5652 5661 2856 2857 5659 5656 2863 2864 2865 5655 2867 2868 2869 2870 5654 5653 5617 2874 2875 2876 5651 2878 2879 2880 2881 2882 5650 5649 ...

result:

ok good plan

Test #62:

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

input:

61
)
)
(
)
)
((
)
)
)
)
(
(
(
)(
))
(
(
(
))
()
)
)
)(
(
(
()
)
(
(
((
(
)(((
()(
(
(
))
)
))
)
(
))
)
(
(
(
(
)()
)
)
(
(
()
(
)
)()
)
(
)
(
(
))(

output:

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

result:

ok good plan

Test #63:

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

input:

11
))()()(
))
(
(
(()
(()
)(()())((
)))()((
(())
())((
))

output:

3 4 5 6 7 9 10 8 1 2 11 

result:

ok good plan

Test #64:

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

input:

86
)
)
)
)
(
)
)
)
((
)
(
)
)
(
)
)
)
((
)
)
)
)
)
)
)
)
(
)
)
(
(
)
)
(
)
)
(
(
(
)
(
(
)
(
)
)
(
(
(
)
(
(
)
(
)
(
(
)
)
(
(
(
)
(
()
(
(
)
(
(
(
(
)
(
)
(
(
()
(
(
)
(
)
(
(
)

output:

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

result:

ok good plan

Test #65:

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

input:

45
)
)
((
)
)
(
)
(
(
)
(
)
)
((
))
(
)
(
)
((
(
(
))
((
)
)
)
(
)
)
)
(
(
(
(
)
)(
(
)
)
)
(
(
(
)

output:

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

result:

ok good plan

Test #66:

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

input:

20
((
)
)))
(
)((
)
(
((()()
(
)(()
(
(
)))
))
))
()(
(
((
())))
(

output:

11 20 18 17 16 12 1 9 8 7 4 10 5 6 13 14 15 3 19 2 

result:

ok good plan

Test #67:

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

input:

10
((
(
)
))
)
)
(
(
)
(

output:

1 2 7 8 10 3 4 5 6 9 

result:

ok good plan

Test #68:

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

input:

14
)()((())(()
(())
)(()(())((()())
())((())(()()(((())
()(()
)(
))(((
))
(((())
(())
)))))
)
()))(()(()
())

output:

5 1 2 9 3 4 6 7 10 13 8 11 12 14 

result:

ok good plan

Test #69:

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

input:

3
())(())()()(
(()
((())))

output:

2 1 3 

result:

ok good plan

Test #70:

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

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

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

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

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

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

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

input:

1
()

output:

1 

result:

ok good plan

Test #74:

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

input:

2
(
)

output:

1 2 

result:

ok good plan

Test #75:

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

input:

2
)
(

output:

2 1 

result:

ok good plan

Test #76:

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

input:

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

output:

1 3 5 2 4 6 

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed