#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
vector<int> t;
bool elobb(int a, int b){
return t[a]>t[b];
}
int main(){
cin.tie(0); ios_base::sync_with_stdio(false);
int x; cin >> x; t.assign(x,int());
int sum=0;
for(int i=0; i<x; i++){
string s; cin >> s; int a=0;
for(int j=0; j<s.length(); j++){
if(s[j]=='(') a++;
if(s[j]==')') a--;
}
t[i]=a; sum+=a;
}
if(sum!=0){cout << "-1"; return 0;}
vector<int> adat;
for(int i=0; i<x; i++) adat.push_back(i);
sort(adat.begin(), adat.end(), elobb);
for(int i=0; i<adat.size(); i++) cout << adat[i]+1 << ' ';
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1824 KiB | ||||
2 | Wrong answer | 4ms | 2232 KiB | ||||
subtask2 | 0/11 | ||||||
3 | Accepted | 3ms | 2272 KiB | ||||
4 | Wrong answer | 2ms | 2312 KiB | ||||
5 | Wrong answer | 2ms | 2312 KiB | ||||
6 | Accepted | 3ms | 2444 KiB | ||||
7 | Wrong answer | 4ms | 2784 KiB | ||||
8 | Wrong answer | 4ms | 3036 KiB | ||||
subtask3 | 6/6 | ||||||
9 | Accepted | 4ms | 3032 KiB | ||||
10 | Accepted | 3ms | 3100 KiB | ||||
11 | Accepted | 3ms | 3072 KiB | ||||
subtask4 | 14/14 | ||||||
12 | Accepted | 4ms | 3360 KiB | ||||
13 | Accepted | 3ms | 3572 KiB | ||||
subtask5 | 0/23 | ||||||
14 | Wrong answer | 4ms | 3532 KiB | ||||
15 | Wrong answer | 3ms | 3820 KiB | ||||
subtask6 | 0/19 | ||||||
16 | Wrong answer | 4ms | 3756 KiB | ||||
17 | Wrong answer | 4ms | 3736 KiB | ||||
18 | Wrong answer | 4ms | 3784 KiB | ||||
19 | Wrong answer | 3ms | 3792 KiB | ||||
20 | Wrong answer | 3ms | 3744 KiB | ||||
21 | Wrong answer | 3ms | 4020 KiB | ||||
22 | Wrong answer | 3ms | 3976 KiB | ||||
23 | Wrong answer | 3ms | 3972 KiB | ||||
24 | Wrong answer | 3ms | 3984 KiB | ||||
subtask7 | 0/27 | ||||||
25 | Wrong answer | 4ms | 4188 KiB | ||||
26 | Wrong answer | 4ms | 4408 KiB | ||||
27 | Wrong answer | 4ms | 4736 KiB | ||||
28 | Wrong answer | 4ms | 4596 KiB | ||||
29 | Accepted | 7ms | 4816 KiB | ||||
30 | Wrong answer | 17ms | 5548 KiB | ||||
31 | Wrong answer | 4ms | 4720 KiB | ||||
32 | Wrong answer | 4ms | 4868 KiB | ||||
33 | Wrong answer | 4ms | 4600 KiB | ||||
34 | Wrong answer | 4ms | 4892 KiB | ||||
35 | Wrong answer | 3ms | 4936 KiB | ||||
36 | Wrong answer | 4ms | 5092 KiB | ||||
37 | Wrong answer | 3ms | 5260 KiB | ||||
38 | Wrong answer | 3ms | 5124 KiB | ||||
39 | Wrong answer | 8ms | 5568 KiB | ||||
40 | Wrong answer | 3ms | 5292 KiB | ||||
41 | Wrong answer | 3ms | 5272 KiB | ||||
42 | Wrong answer | 4ms | 5344 KiB | ||||
43 | Wrong answer | 3ms | 5352 KiB |