#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin>>N;
vector<pair<int,int>>v(N);
int x=0;
for(int i=0;i<N;i++){
string S;
cin>>S;
int y=0,z=0;
for(char c:S){
if(c=='('){
y++;
}
else{
y--;
z=min(z,y);
}
}
x+=y;
v[i]={z,i};
}
if(x!=0){
cout<<-1<<'\n';
return 0;
}
sort(v.rbegin(),v.rend());
for(auto[_,i]:v){
cout<<i+1<<' ';
}
cout<<'\n';
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1704 KiB | ||||
2 | Accepted | 4ms | 2108 KiB | ||||
subtask2 | 0/11 | ||||||
3 | Wrong answer | 2ms | 2012 KiB | ||||
4 | Wrong answer | 3ms | 2148 KiB | ||||
5 | Wrong answer | 2ms | 2224 KiB | ||||
6 | Accepted | 3ms | 2460 KiB | ||||
7 | Accepted | 4ms | 2700 KiB | ||||
8 | Wrong answer | 4ms | 2888 KiB | ||||
subtask3 | 6/6 | ||||||
9 | Accepted | 4ms | 2632 KiB | ||||
10 | Accepted | 3ms | 2632 KiB | ||||
11 | Accepted | 3ms | 2888 KiB | ||||
subtask4 | 14/14 | ||||||
12 | Accepted | 4ms | 2868 KiB | ||||
13 | Accepted | 3ms | 2860 KiB | ||||
subtask5 | 0/23 | ||||||
14 | Wrong answer | 4ms | 2900 KiB | ||||
15 | Wrong answer | 4ms | 3148 KiB | ||||
subtask6 | 0/19 | ||||||
16 | Wrong answer | 4ms | 3252 KiB | ||||
17 | Wrong answer | 4ms | 3452 KiB | ||||
18 | Accepted | 4ms | 3640 KiB | ||||
19 | Wrong answer | 3ms | 3516 KiB | ||||
20 | Wrong answer | 4ms | 3644 KiB | ||||
21 | Wrong answer | 3ms | 3692 KiB | ||||
22 | Wrong answer | 4ms | 3632 KiB | ||||
23 | Wrong answer | 3ms | 3608 KiB | ||||
24 | Wrong answer | 4ms | 3612 KiB | ||||
subtask7 | 0/27 | ||||||
25 | Wrong answer | 4ms | 3412 KiB | ||||
26 | Wrong answer | 4ms | 3560 KiB | ||||
27 | Wrong answer | 4ms | 3504 KiB | ||||
28 | Wrong answer | 6ms | 3552 KiB | ||||
29 | Wrong answer | 8ms | 3640 KiB | ||||
30 | Wrong answer | 18ms | 4856 KiB | ||||
31 | Wrong answer | 4ms | 3524 KiB | ||||
32 | Wrong answer | 4ms | 3672 KiB | ||||
33 | Wrong answer | 4ms | 3516 KiB | ||||
34 | Wrong answer | 4ms | 3688 KiB | ||||
35 | Wrong answer | 3ms | 3496 KiB | ||||
36 | Wrong answer | 4ms | 3696 KiB | ||||
37 | Wrong answer | 3ms | 3504 KiB | ||||
38 | Wrong answer | 3ms | 3496 KiB | ||||
39 | Wrong answer | 9ms | 3856 KiB | ||||
40 | Wrong answer | 3ms | 3532 KiB | ||||
41 | Wrong answer | 3ms | 3464 KiB | ||||
42 | Wrong answer | 4ms | 3688 KiB | ||||
43 | Wrong answer | 3ms | 3684 KiB |