#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=count(S.begin(),S.end(),'(')-count(S.begin(),S.end(),')');
x+=y;
v[i]={y,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 | 1828 KiB | ||||
2 | Wrong answer | 4ms | 2368 KiB | ||||
subtask2 | 0/11 | ||||||
3 | Accepted | 3ms | 2432 KiB | ||||
4 | Wrong answer | 3ms | 2652 KiB | ||||
5 | Accepted | 3ms | 2864 KiB | ||||
6 | Accepted | 3ms | 2956 KiB | ||||
7 | Accepted | 3ms | 3752 KiB | ||||
8 | Wrong answer | 4ms | 4072 KiB | ||||
subtask3 | 6/6 | ||||||
9 | Accepted | 4ms | 4120 KiB | ||||
10 | Accepted | 3ms | 4200 KiB | ||||
11 | Accepted | 4ms | 4532 KiB | ||||
subtask4 | 14/14 | ||||||
12 | Accepted | 4ms | 4756 KiB | ||||
13 | Accepted | 4ms | 5044 KiB | ||||
subtask5 | 0/23 | ||||||
14 | Wrong answer | 4ms | 5224 KiB | ||||
15 | Wrong answer | 4ms | 5420 KiB | ||||
subtask6 | 0/19 | ||||||
16 | Wrong answer | 4ms | 5716 KiB | ||||
17 | Wrong answer | 4ms | 6192 KiB | ||||
18 | Wrong answer | 4ms | 6420 KiB | ||||
19 | Wrong answer | 4ms | 6624 KiB | ||||
20 | Wrong answer | 4ms | 6828 KiB | ||||
21 | Wrong answer | 4ms | 7068 KiB | ||||
22 | Wrong answer | 4ms | 7200 KiB | ||||
23 | Wrong answer | 4ms | 7176 KiB | ||||
24 | Wrong answer | 4ms | 7572 KiB | ||||
subtask7 | 0/27 | ||||||
25 | Wrong answer | 3ms | 7708 KiB | ||||
26 | Wrong answer | 4ms | 7920 KiB | ||||
27 | Wrong answer | 4ms | 8256 KiB | ||||
28 | Wrong answer | 4ms | 8556 KiB | ||||
29 | Accepted | 7ms | 8916 KiB | ||||
30 | Wrong answer | 19ms | 10288 KiB | ||||
31 | Wrong answer | 4ms | 9488 KiB | ||||
32 | Wrong answer | 4ms | 9652 KiB | ||||
33 | Wrong answer | 4ms | 9832 KiB | ||||
34 | Wrong answer | 4ms | 10076 KiB | ||||
35 | Wrong answer | 4ms | 10344 KiB | ||||
36 | Wrong answer | 6ms | 10976 KiB | ||||
37 | Wrong answer | 4ms | 11076 KiB | ||||
38 | Wrong answer | 4ms | 11388 KiB | ||||
39 | Wrong answer | 9ms | 11992 KiB | ||||
40 | Wrong answer | 3ms | 11780 KiB | ||||
41 | Wrong answer | 3ms | 11764 KiB | ||||
42 | Wrong answer | 4ms | 12020 KiB | ||||
43 | Wrong answer | 4ms | 11980 KiB |