#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
vector<pair<int,int>> t;
bool elobb(int a, int b){
if(t[a].first==t[b].first) return t[a].second<t[b].second;
return t[a].first>t[b].first;
}
int main(){
cin.tie(0); ios_base::sync_with_stdio(false);
int x; cin >> x;
int sum=0;
for(int i=0; i<x; i++){
string s; cin >> s; int a=0; int ma=0;
for(int j=0; j<s.length(); j++){
if(s[j]=='(') a++;
if(s[j]==')') a--;
}
sum+=a; ma=max(ma,a);
t.push_back(make_pair(a,ma));
}
//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 | 2240 KiB | ||||
subtask2 | 0/11 | ||||||
3 | Accepted | 3ms | 2236 KiB | ||||
4 | Wrong answer | 3ms | 2440 KiB | ||||
5 | Wrong answer | 2ms | 2576 KiB | ||||
6 | Accepted | 3ms | 2772 KiB | ||||
7 | Wrong answer | 4ms | 3096 KiB | ||||
8 | Wrong answer | 4ms | 3352 KiB | ||||
subtask3 | 0/6 | ||||||
9 | Accepted | 4ms | 3156 KiB | ||||
10 | Wrong answer | 4ms | 3164 KiB | ||||
11 | Wrong answer | 4ms | 3156 KiB | ||||
subtask4 | 14/14 | ||||||
12 | Accepted | 4ms | 3168 KiB | ||||
13 | Accepted | 3ms | 3176 KiB | ||||
subtask5 | 0/23 | ||||||
14 | Wrong answer | 4ms | 3452 KiB | ||||
15 | Wrong answer | 3ms | 3696 KiB | ||||
subtask6 | 0/19 | ||||||
16 | Wrong answer | 4ms | 3612 KiB | ||||
17 | Wrong answer | 4ms | 3956 KiB | ||||
18 | Wrong answer | 4ms | 3836 KiB | ||||
19 | Wrong answer | 3ms | 3796 KiB | ||||
20 | Wrong answer | 4ms | 4016 KiB | ||||
21 | Wrong answer | 3ms | 4248 KiB | ||||
22 | Wrong answer | 3ms | 4212 KiB | ||||
23 | Wrong answer | 3ms | 4340 KiB | ||||
24 | Wrong answer | 3ms | 4236 KiB | ||||
subtask7 | 0/27 | ||||||
25 | Wrong answer | 4ms | 4148 KiB | ||||
26 | Wrong answer | 4ms | 4180 KiB | ||||
27 | Wrong answer | 4ms | 4468 KiB | ||||
28 | Wrong answer | 4ms | 4632 KiB | ||||
29 | Accepted | 7ms | 4920 KiB | ||||
30 | Wrong answer | 17ms | 6136 KiB | ||||
31 | Wrong answer | 4ms | 4912 KiB | ||||
32 | Wrong answer | 4ms | 4876 KiB | ||||
33 | Wrong answer | 4ms | 4716 KiB | ||||
34 | Wrong answer | 4ms | 5064 KiB | ||||
35 | Wrong answer | 3ms | 5160 KiB | ||||
36 | Wrong answer | 4ms | 5240 KiB | ||||
37 | Wrong answer | 3ms | 5012 KiB | ||||
38 | Wrong answer | 3ms | 5028 KiB | ||||
39 | Wrong answer | 8ms | 5652 KiB | ||||
40 | Wrong answer | 3ms | 5048 KiB | ||||
41 | Wrong answer | 3ms | 4984 KiB | ||||
42 | Wrong answer | 4ms | 5212 KiB | ||||
43 | Wrong answer | 3ms | 5060 KiB |