101852024-03-29 11:12:58111Zárójelekcpp17Wrong answer 20/10018ms4856 KiB
#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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1704 KiB
2Accepted4ms2108 KiB
subtask20/11
3Wrong answer2ms2012 KiB
4Wrong answer3ms2148 KiB
5Wrong answer2ms2224 KiB
6Accepted3ms2460 KiB
7Accepted4ms2700 KiB
8Wrong answer4ms2888 KiB
subtask36/6
9Accepted4ms2632 KiB
10Accepted3ms2632 KiB
11Accepted3ms2888 KiB
subtask414/14
12Accepted4ms2868 KiB
13Accepted3ms2860 KiB
subtask50/23
14Wrong answer4ms2900 KiB
15Wrong answer4ms3148 KiB
subtask60/19
16Wrong answer4ms3252 KiB
17Wrong answer4ms3452 KiB
18Accepted4ms3640 KiB
19Wrong answer3ms3516 KiB
20Wrong answer4ms3644 KiB
21Wrong answer3ms3692 KiB
22Wrong answer4ms3632 KiB
23Wrong answer3ms3608 KiB
24Wrong answer4ms3612 KiB
subtask70/27
25Wrong answer4ms3412 KiB
26Wrong answer4ms3560 KiB
27Wrong answer4ms3504 KiB
28Wrong answer6ms3552 KiB
29Wrong answer8ms3640 KiB
30Wrong answer18ms4856 KiB
31Wrong answer4ms3524 KiB
32Wrong answer4ms3672 KiB
33Wrong answer4ms3516 KiB
34Wrong answer4ms3688 KiB
35Wrong answer3ms3496 KiB
36Wrong answer4ms3696 KiB
37Wrong answer3ms3504 KiB
38Wrong answer3ms3496 KiB
39Wrong answer9ms3856 KiB
40Wrong answer3ms3532 KiB
41Wrong answer3ms3464 KiB
42Wrong answer4ms3688 KiB
43Wrong answer3ms3684 KiB