38072023-03-03 09:11:55kohumarkZárójelekcpp17Wrong answer 20/10017ms5568 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

vector<int> t;
bool elobb(int a, int b){
    return t[a]>t[b];
}

int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    int x; cin >> x; t.assign(x,int());
    int sum=0;
    for(int i=0; i<x; i++){
        string s; cin >> s; int a=0;
        for(int j=0; j<s.length(); j++){
            if(s[j]=='(') a++;
            if(s[j]==')') a--;
        }
        t[i]=a; sum+=a;
    }
    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 answer4ms2232 KiB
subtask20/11
3Accepted3ms2272 KiB
4Wrong answer2ms2312 KiB
5Wrong answer2ms2312 KiB
6Accepted3ms2444 KiB
7Wrong answer4ms2784 KiB
8Wrong answer4ms3036 KiB
subtask36/6
9Accepted4ms3032 KiB
10Accepted3ms3100 KiB
11Accepted3ms3072 KiB
subtask414/14
12Accepted4ms3360 KiB
13Accepted3ms3572 KiB
subtask50/23
14Wrong answer4ms3532 KiB
15Wrong answer3ms3820 KiB
subtask60/19
16Wrong answer4ms3756 KiB
17Wrong answer4ms3736 KiB
18Wrong answer4ms3784 KiB
19Wrong answer3ms3792 KiB
20Wrong answer3ms3744 KiB
21Wrong answer3ms4020 KiB
22Wrong answer3ms3976 KiB
23Wrong answer3ms3972 KiB
24Wrong answer3ms3984 KiB
subtask70/27
25Wrong answer4ms4188 KiB
26Wrong answer4ms4408 KiB
27Wrong answer4ms4736 KiB
28Wrong answer4ms4596 KiB
29Accepted7ms4816 KiB
30Wrong answer17ms5548 KiB
31Wrong answer4ms4720 KiB
32Wrong answer4ms4868 KiB
33Wrong answer4ms4600 KiB
34Wrong answer4ms4892 KiB
35Wrong answer3ms4936 KiB
36Wrong answer4ms5092 KiB
37Wrong answer3ms5260 KiB
38Wrong answer3ms5124 KiB
39Wrong answer8ms5568 KiB
40Wrong answer3ms5292 KiB
41Wrong answer3ms5272 KiB
42Wrong answer4ms5344 KiB
43Wrong answer3ms5352 KiB