38122023-03-03 09:22:20kohumarkZárójelekcpp17Wrong answer 14/10017ms5888 KiB
#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--;
            ma=min(ma,a);
        }
        sum+=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 << ' ';
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1824 KiB
2Wrong answer4ms2204 KiB
subtask20/11
3Accepted3ms2320 KiB
4Wrong answer3ms2460 KiB
5Accepted3ms2688 KiB
6Accepted2ms2884 KiB
7Wrong answer4ms3224 KiB
8Wrong answer4ms3488 KiB
subtask30/6
9Accepted4ms3232 KiB
10Wrong answer4ms3516 KiB
11Wrong answer4ms3824 KiB
subtask414/14
12Accepted4ms3696 KiB
13Accepted4ms3736 KiB
subtask50/23
14Wrong answer4ms4116 KiB
15Wrong answer4ms4112 KiB
subtask60/19
16Wrong answer4ms4076 KiB
17Wrong answer4ms4284 KiB
18Wrong answer4ms4284 KiB
19Wrong answer4ms4212 KiB
20Wrong answer4ms4176 KiB
21Wrong answer4ms4240 KiB
22Wrong answer4ms4500 KiB
23Wrong answer4ms4456 KiB
24Wrong answer3ms4452 KiB
subtask70/27
25Wrong answer4ms4396 KiB
26Wrong answer4ms4560 KiB
27Wrong answer4ms4456 KiB
28Wrong answer4ms4452 KiB
29Accepted7ms4852 KiB
30Wrong answer17ms5888 KiB
31Wrong answer4ms4740 KiB
32Wrong answer4ms4804 KiB
33Wrong answer4ms4708 KiB
34Wrong answer4ms4820 KiB
35Wrong answer3ms4596 KiB
36Wrong answer4ms4820 KiB
37Wrong answer3ms4620 KiB
38Wrong answer4ms4644 KiB
39Wrong answer8ms5236 KiB
40Wrong answer3ms4648 KiB
41Wrong answer3ms4612 KiB
42Wrong answer4ms4896 KiB
43Wrong answer4ms4716 KiB