QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#116432#5108. Prehistoric Programsduongnc000AC ✓225ms26976kbC++202.5kb2023-06-28 22:53:532023-06-28 22:53:53

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-28 22:53:53]
  • 评测
  • 测评结果:AC
  • 用时:225ms
  • 内存:26976kb
  • [2023-06-28 22:53:53]
  • 提交

answer

/*
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt")
*/

#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define isz(x) (int)x.size()
using namespace std;

const int mxN = 1e6 + 5;
const int mod = 1e9 + 7;
const ll oo = 1e18;

int n;
pii p[mxN];
vi pos, neg;

bool cmp(int x, int y) {
	pii a = p[x], b = p[y];
	if(a.ff != b.ff) return (a.ff < b.ff);
	else return (a.ss > b.ss);
}

void kill() {
	cout << "impossible" << endl;
	exit(0);
}

void solve() {
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		string s; cin >> s;
		int sum = 0;
		for(char c : s)
			sum += (c == '(' ? 1 : -1);
		if(sum >= 0) {
			int cur_sum = 0, cur_min = 0;
			for(char c : s) {
				cur_sum += (c == '(' ? 1 : -1);
				cur_min = min(cur_min, cur_sum);
			}
			pos.emplace_back(i);
			p[i] = {-cur_min, cur_sum};
		}
		else {
			reverse(all(s));
			int cur_sum = 0, cur_min = 0;
			for(char c : s) {
				cur_sum += (c == ')' ? 1 : -1);
				cur_min = min(cur_min, cur_sum);
			}
			neg.emplace_back(i);
			p[i] = {-cur_min, cur_sum};
		}
	}
	sort(all(pos), cmp);
	sort(all(neg), cmp);
	int cur_sum_pos = 0;
	for(int &val : pos) {
		if(p[val].ff > cur_sum_pos)
			kill();
		cur_sum_pos += p[val].ss;
	}

	int cur_sum_neg = 0;
	for(int &val : neg) {
		if(p[val].ff > cur_sum_neg)
			kill();
		cur_sum_neg += p[val].ss;
	}

	if(cur_sum_pos != cur_sum_neg)
		kill();

	reverse(all(neg));
	pos.insert(pos.end(), all(neg));

	for(int &val : pos)
		cout << val << " ";
	cout << endl;
}

signed main() {

#ifndef CDuongg
    if(fopen(taskname".inp", "r"))
        assert(freopen(taskname".inp", "r", stdin)), assert(freopen(taskname".out", "w", stdout));
#else
    freopen("bai3.inp", "r", stdin);
    freopen("bai3.out", "w", stdout);
    auto start = chrono::high_resolution_clock::now();
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int t = 1; //cin >> t;
	while(t--) solve();

#ifdef CDuongg
	auto end = chrono::high_resolution_clock::now();
	cout << "\n"; for(int i = 1; i <= 100; ++i) cout << '=';
	cout << "\nExecution time: " << chrono::duration_cast<chrono::milliseconds> (end - start).count() << "[ms]" << endl;
#endif

}

詳細信息

Test #1:

score: 100
Accepted
time: 11ms
memory: 4040kb

input:

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

output:

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

result:

ok good plan

Test #2:

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

input:

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

output:

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

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

1 2 

result:

ok good plan

Test #4:

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

input:

2
((
))

output:

1 2 

result:

ok good plan

Test #5:

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

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

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

input:

3
()
(
)

output:

2 1 3 

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2 1 3 

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

2 4 3 1 5 

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

1 3 2 

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

311 329 479 232 443 483 199 80 414 297 177 265 253 357 350 211 325 290 362 296 308 309 351 315 318 320 321 340 327 349 345 330 353 334 338 344 343 339 262 234 239 1 241 242 243 247 248 249 251 254 256 258 288 264 268 269 271 274 275 277 282 283 284 285 286 287 459 428 429 431 434 435 436 437 439 440...

result:

ok good plan

Test #12:

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

input:

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

output:

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

result:

ok good plan

Test #13:

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

input:

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

output:

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

result:

ok good plan

Test #14:

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

input:

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

output:

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

result:

ok good plan

Test #15:

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

input:

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

output:

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

result:

ok good plan

Test #16:

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

input:

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

output:

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

result:

ok good plan

Test #17:

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

input:

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

output:

468 163 390 379 204 396 707 590 585 4 122 1 405 657 658 601 79 180 34 274 104 473 158 149 681 571 547 504 526 730 269 705 485 108 25 230 341 103 426 395 156 406 218 246 382 494 41 43 481 408 418 131 55 56 606 166 164 530 357 378 358 581 361 362 578 574 368 369 371 374 624 326 636 622 287 618 294 612...

result:

ok good plan

Test #18:

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

input:

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

output:

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

result:

ok good plan

Test #19:

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

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

input:

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

output:

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

result:

ok good plan

Test #21:

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

input:

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

output:

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

result:

ok good plan

Test #22:

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

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

score: 0
Accepted
time: 165ms
memory: 18344kb

input:

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

output:

149392 264227 387984 770337 898404 83071 995820 269214 349084 857929 897909 731069 604894 385160 174818 196234 765299 352796 904916 760108 134097 708004 526593 308325 489285 592970 675083 748267 911588 501576 540367 992894 309146 900795 160328 342091 474263 197429 267140 619800 475916 610823 507757 ...

result:

ok good plan

Test #26:

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

input:

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

output:

impossible

result:

ok impossible

Test #27:

score: 0
Accepted
time: 25ms
memory: 19908kb

input:

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

output:

impossible

result:

ok impossible

Test #28:

score: 0
Accepted
time: 19ms
memory: 20236kb

input:

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

output:

1 

result:

ok good plan

Test #29:

score: 0
Accepted
time: 8ms
memory: 20204kb

input:

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

output:

impossible

result:

ok impossible

Test #30:

score: 0
Accepted
time: 25ms
memory: 20700kb

input:

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

output:

impossible

result:

ok impossible

Test #31:

score: 0
Accepted
time: 20ms
memory: 15228kb

input:

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

output:

2 1 

result:

ok good plan

Test #32:

score: 0
Accepted
time: 11ms
memory: 16104kb

input:

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

output:

impossible

result:

ok impossible

Test #33:

score: 0
Accepted
time: 19ms
memory: 19744kb

input:

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

output:

3 1 2 

result:

ok good plan

Test #34:

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

input:

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

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 85ms
memory: 14908kb

input:

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

output:

impossible

result:

ok impossible

Test #36:

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

input:

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

output:

666658 666688 666686 666684 666682 666680 666678 666676 666674 666672 666670 666668 666666 666664 666662 666660 666690 666656 666654 666652 666650 666648 666646 666644 666642 666640 666638 666636 666634 666632 666630 666720 666750 666748 666746 666744 666742 666740 666738 666736 666734 666732 666730...

result:

ok good plan

Test #37:

score: 0
Accepted
time: 106ms
memory: 26976kb

input:

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

output:

833328 833343 833342 833341 833340 833339 833338 833337 833336 833335 833334 833333 833332 833331 833330 833329 833344 833327 833326 833325 833324 833323 833322 833321 833320 833319 833318 833317 833316 833315 833314 833359 833374 833373 833372 833371 833370 833369 833368 833367 833366 833365 833364...

result:

ok good plan

Test #38:

score: 0
Accepted
time: 223ms
memory: 17428kb

input:

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

output:

510441 164663 944202 483356 500584 889056 637097 732016 879218 183559 679768 163748 496501 90286 763948 924596 911154 629235 321244 428626 590693 323909 598737 475331 261112 651410 378339 480176 295142 67591 970762 850025 235797 947844 451519 354542 553153 130656 491924 740159 897141 766848 880821 4...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 225ms
memory: 17268kb

input:

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

output:

568499 250826 629151 494698 675014 536620 795023 425960 985988 926090 463859 561779 300744 106383 575206 137311 597972 689231 963161 353729 427235 388609 333208 207485 746420 129338 930603 770416 123122 623824 905927 834142 116108 470327 997127 696104 487205 437875 713994 12900 192291 289835 209291 ...

result:

ok good plan

Test #40:

score: 0
Accepted
time: 48ms
memory: 3652kb

input:

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

output:

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

result:

ok good plan

Test #41:

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

input:

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

output:

12 48 75 7 81 36 33 76 99 16 10 105 59 108 70 22 5 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: 74ms
memory: 5752kb

input:

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

output:

51373 43701 17030 24272 1485 5483 42660 27238 16598 63066 56433 63470 16623 14019 17061 36141 40015 14405 45353 9742 34448 25754 9313 13231 13709 25751 27954 56930 1889 10165 63327 30549 9388 53450 29121 64001 12907 17456 5582 9834 48613 11895 23130 50885 12456 39672 17043 44572 25948 13600 13565 26...

result:

ok good plan

Test #43:

score: 0
Accepted
time: 184ms
memory: 15236kb

input:

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

output:

204843 504790 42954 343862 399438 498212 63131 118929 562227 85220 386793 329734 235660 87230 400919 53936 607247 25279 298959 323865 616123 121461 678888 430469 203448 665377 382031 422036 362444 538238 316054 723227 701764 485491 322499 216616 417795 620885 419793 167630 654766 282080 373707 16826...

result:

ok good plan

Test #44:

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

input:

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

output:

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

result:

ok good plan

Test #45:

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

input:

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

output:

6 3 7 2 1 4 5 8 

result:

ok good plan

Test #46:

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

input:

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

output:

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

result:

ok good plan

Test #47:

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

input:

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

output:

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

result:

ok good plan

Test #48:

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

input:

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

output:

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

result:

ok good plan

Test #49:

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

input:

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

output:

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

result:

ok good plan

Test #50:

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

input:

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

output:

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

result:

ok good plan

Test #51:

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

input:

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

output:

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

result:

ok good plan

Test #52:

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

input:

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

output:

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

result:

ok good plan

Test #53:

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

input:

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

output:

2709 1426 1378 883 1969 2952 1641 3074 3641 2067 1129 1706 540 549 3325 3356 1153 2241 3417 731 2168 193 183 2860 2202 2001 3670 1407 2115 3447 473 3443 622 3436 2950 2506 213 1291 413 481 610 256 2962 646 1382 679 2889 2131 1383 2345 2493 1985 2964 1527 3473 202 2664 3469 1836 1521 1414 2010 2273 1...

result:

ok good plan

Test #54:

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

input:

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

output:

7172 515 4898 7337 7783 2024 4936 4460 5574 5573 811 5276 5281 258 2149 7601 6388 701 707 7590 7117 2664 4003 4674 4464 4977 6082 7576 3568 6817 187 7669 6825 3243 2279 6245 2113 3949 7014 564 1169 4517 4941 1802 1647 7007 3556 1153 7288 3116 6228 5644 4506 2980 3017 5006 1558 856 2226 6403 6180 341...

result:

ok good plan

Test #55:

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

input:

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

output:

1037 1937 271 1431 1730 1146 1700 2179 1306 935 974 2198 39 1857 2065 1742 584 1438 1440 1377 1357 1442 1910 2117 200 2227 2021 2070 1881 821 1764 768 139 1666 1297 640 665 543 1977 532 339 1420 2004 2058 1640 174 2024 1288 896 2028 1339 413 783 292 1906 1769 1035 1318 367 581 1718 72 1812 302 1198 ...

result:

ok good plan

Test #56:

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

input:

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

output:

1004 3255 3163 2854 1316 2498 2091 3432 2920 3052 708 1147 1929 2653 1718 3759 1720 1789 1463 695 857 3673 82 2652 918 1836 1509 107 928 3012 1520 778 777 775 821 2575 854 856 2588 652 3383 167 165 1757 1451 2027 1278 3068 584 2608 911 1862 1584 739 1580 2735 2485 1047 1884 1369 1393 2746 3655 2748 ...

result:

ok good plan

Test #57:

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

input:

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

output:

3932 3496 180 2783 4856 2518 2771 4937 1860 2804 2813 1657 3143 3268 2293 3785 1183 210 3979 4437 12 294 412 561 342 1655 476 1710 1758 1825 441 361 1606 323 1928 2083 2100 2237 2315 1124 5209 698 779 5177 567 863 1026 5143 1071 491 1173 2625 5103 1231 1465 1570 5026 505 4240 3683 3692 3746 3771 382...

result:

ok good plan

Test #58:

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

input:

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

output:

208 24 206 1199 3153 2388 633 974 2109 1654 2632 1782 1187 3344 1668 1799 2823 3358 3361 1652 1175 1031 2642 377 885 167 2950 2445 3267 1437 717 714 980 1273 1401 2463 2464 701 1413 2283 144 259 1890 2076 926 640 639 1848 1353 3066 620 1827 2751 80 368 66 1887 2193 412 1037 1893 1872 737 2985 1866 4...

result:

ok good plan

Test #59:

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

input:

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

output:

3246 253 2233 1962 2547 2585 2926 76 1932 3461 278 2781 708 2436 1197 2767 1886 3476 930 1515 2711 2440 2447 1213 3209 1566 1173 1092 1100 2571 299 246 2079 218 3320 148 1836 793 484 3957 3954 2372 2166 2890 1360 1394 202 2505 289 2269 3715 1763 180 1338 1184 2304 1329 1310 1235 3654 2413 2344 255 1...

result:

ok good plan

Test #60:

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

input:

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

output:

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

result:

ok good plan

Test #61:

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

input:

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

output:

5145 784 2471 3315 4547 366 2135 3877 3887 1665 5142 4061 4683 2537 2973 844 4865 6536 103 3926 2181 4751 89 1497 5544 3228 1525 1547 4198 6789 6842 6845 1103 5036 4080 4226 5975 5459 6352 4662 3823 1201 346 2796 6482 3549 5245 1782 3037 1803 4428 905 3539 469 5782 5819 3020 5716 5784 2670 5790 976 ...

result:

ok good plan

Test #62:

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

input:

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

output:

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

result:

ok good plan

Test #63:

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

input:

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

output:

3 4 5 6 9 7 10 8 1 11 2 

result:

ok good plan

Test #64:

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

input:

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

output:

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

result:

ok good plan

Test #65:

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

input:

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

output:

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

result:

ok good plan

Test #66:

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

input:

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

output:

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

result:

ok good plan

Test #67:

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

input:

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

output:

1 2 7 8 10 9 6 5 3 4 

result:

ok good plan

Test #68:

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

input:

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

output:

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

result:

ok good plan

Test #69:

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

input:

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

output:

2 1 3 

result:

ok good plan

Test #70:

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

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

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

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

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

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

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

input:

1
()

output:

1 

result:

ok good plan

Test #74:

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

input:

2
(
)

output:

1 2 

result:

ok good plan

Test #75:

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

input:

2
)
(

output:

2 1 

result:

ok good plan

Test #76:

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

input:

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

output:

3 5 1 2 6 4 

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed