53522023-04-26 10:52:26kohumarkZárójelekcpp17Wrong answer 14/10028ms6708 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

bool ren(pair<int,pair<int,int>> a, pair<int,pair<int,int>> b){
	if(a.second.second==b.second.second) return a.second.first-a.second.second > b.second.first-b.second.second;
	return a.second.second < b.second.second;
}

int main(){
	int n; cin >> n;
	vector<pair<int,pair<int,int>>> t;
	for(int i=0; i<n; i++){
		string x; cin >> x;
		pair<int,int> act;
		for(int j=0; j<(int)x.length(); j++){
			if(x[j]=='(') act.first++;
			else{
				if(act.first>0) act.first--;
				else{
					act.second++;
				}
			}
		}
		t.push_back(make_pair(i+1,act));
	}
	sort(t.begin(), t.end(), ren);
	for(auto it=t.begin(); it!=t.end(); it++) cout << (*it).first << ' ';
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1808 KiB
2Accepted8ms2236 KiB
subtask20/11
3Accepted3ms2272 KiB
4Wrong answer3ms2524 KiB
5Wrong answer3ms2700 KiB
6Accepted3ms2804 KiB
7Accepted8ms3444 KiB
8Wrong answer8ms3532 KiB
subtask30/6
9Accepted8ms3220 KiB
10Wrong answer8ms3460 KiB
11Wrong answer8ms3408 KiB
subtask414/14
12Accepted8ms3728 KiB
13Accepted8ms3944 KiB
subtask50/23
14Wrong answer8ms3904 KiB
15Wrong answer8ms4024 KiB
subtask60/19
16Wrong answer8ms4216 KiB
17Wrong answer8ms4292 KiB
18Accepted8ms4536 KiB
19Wrong answer8ms4668 KiB
20Wrong answer8ms4420 KiB
21Wrong answer6ms4632 KiB
22Wrong answer6ms4572 KiB
23Wrong answer6ms4600 KiB
24Wrong answer6ms4700 KiB
subtask70/27
25Wrong answer8ms4660 KiB
26Wrong answer8ms4652 KiB
27Wrong answer9ms4704 KiB
28Wrong answer9ms4900 KiB
29Wrong answer13ms5392 KiB
30Wrong answer28ms6708 KiB
31Wrong answer8ms5348 KiB
32Wrong answer8ms5536 KiB
33Wrong answer8ms5360 KiB
34Wrong answer9ms5508 KiB
35Wrong answer7ms5168 KiB
36Wrong answer9ms5372 KiB
37Wrong answer7ms5152 KiB
38Wrong answer8ms5156 KiB
39Wrong answer14ms6020 KiB
40Wrong answer4ms5188 KiB
41Wrong answer3ms5132 KiB
42Accepted7ms5424 KiB
43Wrong answer6ms5272 KiB