5358 2023. 04. 26 13:15:02 horvathabel Zárójelek cpp17 Wrong answer 20/100 27ms 5468 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<pair<int, int>> v;
    int check=0;
    for (int i=0; i<n;i++){
        string a;
        cin>>a;
        int num=0;
        for (char x:a){
            if (x==')') num--;
            else num++;
        }
        check+=num;
        v.push_back({num,i+1});
    }

    sort(v.begin(), v.end());
    if (check!=0){
        cout<<-1;
        return 0;
    }
    for (int i=n-1;i>=0;i--){
        cout<<v[i].second<<" ";
    }
    }
Subtask Sum Test Verdict Time Memory
subtask1 0/0
1 Accepted 3ms 1812 KiB
2 Wrong answer 8ms 2080 KiB
subtask2 0/11
3 Accepted 3ms 2264 KiB
4 Wrong answer 3ms 2332 KiB
5 Accepted 3ms 2524 KiB
6 Accepted 2ms 2608 KiB
7 Accepted 7ms 3240 KiB
8 Wrong answer 7ms 3192 KiB
subtask3 6/6
9 Accepted 8ms 2980 KiB
10 Accepted 8ms 3196 KiB
11 Accepted 8ms 3280 KiB
subtask4 14/14
12 Accepted 8ms 3484 KiB
13 Accepted 8ms 3580 KiB
subtask5 0/23
14 Wrong answer 8ms 3712 KiB
15 Wrong answer 8ms 3788 KiB
subtask6 0/19
16 Wrong answer 7ms 3872 KiB
17 Wrong answer 7ms 3896 KiB
18 Wrong answer 8ms 3996 KiB
19 Wrong answer 8ms 4088 KiB
20 Wrong answer 8ms 4092 KiB
21 Wrong answer 6ms 4140 KiB
22 Wrong answer 6ms 4340 KiB
23 Wrong answer 6ms 4300 KiB
24 Wrong answer 6ms 4300 KiB
subtask7 0/27
25 Wrong answer 7ms 4288 KiB
26 Wrong answer 8ms 4244 KiB
27 Wrong answer 8ms 4236 KiB
28 Wrong answer 8ms 4496 KiB
29 Accepted 10ms 4596 KiB
30 Wrong answer 27ms 5468 KiB
31 Wrong answer 8ms 4364 KiB
32 Wrong answer 8ms 4476 KiB
33 Wrong answer 8ms 4384 KiB
34 Wrong answer 9ms 4424 KiB
35 Wrong answer 7ms 4324 KiB
36 Wrong answer 9ms 4788 KiB
37 Wrong answer 7ms 4652 KiB
38 Wrong answer 7ms 4736 KiB
39 Wrong answer 14ms 5308 KiB
40 Wrong answer 4ms 4764 KiB
41 Wrong answer 3ms 4584 KiB
42 Wrong answer 7ms 4936 KiB
43 Wrong answer 6ms 4812 KiB