38102023-03-03 09:20:38kohumarkZárójelekcpp17Wrong answer 14/10017ms6136 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--;
        }
        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 << ' ';
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1824 KiB
2Wrong answer4ms2240 KiB
subtask20/11
3Accepted3ms2236 KiB
4Wrong answer3ms2440 KiB
5Wrong answer2ms2576 KiB
6Accepted3ms2772 KiB
7Wrong answer4ms3096 KiB
8Wrong answer4ms3352 KiB
subtask30/6
9Accepted4ms3156 KiB
10Wrong answer4ms3164 KiB
11Wrong answer4ms3156 KiB
subtask414/14
12Accepted4ms3168 KiB
13Accepted3ms3176 KiB
subtask50/23
14Wrong answer4ms3452 KiB
15Wrong answer3ms3696 KiB
subtask60/19
16Wrong answer4ms3612 KiB
17Wrong answer4ms3956 KiB
18Wrong answer4ms3836 KiB
19Wrong answer3ms3796 KiB
20Wrong answer4ms4016 KiB
21Wrong answer3ms4248 KiB
22Wrong answer3ms4212 KiB
23Wrong answer3ms4340 KiB
24Wrong answer3ms4236 KiB
subtask70/27
25Wrong answer4ms4148 KiB
26Wrong answer4ms4180 KiB
27Wrong answer4ms4468 KiB
28Wrong answer4ms4632 KiB
29Accepted7ms4920 KiB
30Wrong answer17ms6136 KiB
31Wrong answer4ms4912 KiB
32Wrong answer4ms4876 KiB
33Wrong answer4ms4716 KiB
34Wrong answer4ms5064 KiB
35Wrong answer3ms5160 KiB
36Wrong answer4ms5240 KiB
37Wrong answer3ms5012 KiB
38Wrong answer3ms5028 KiB
39Wrong answer8ms5652 KiB
40Wrong answer3ms5048 KiB
41Wrong answer3ms4984 KiB
42Wrong answer4ms5212 KiB
43Wrong answer3ms5060 KiB