9885 | 2024-03-14 22:39:55 | BakosCsongor | Zárójel csere | cpp17 | Wrong answer 0/100 | 1.1s | 8552 KiB |
/*
4
)()(
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
vector <char> zarojel;
vector <int> sorszam;
//ifstream cin("input0.txt");
cin >> N;
for(int i = 0; i < N; i++)
{
char c;
cin >> c;
zarojel.push_back(c);
sorszam.push_back(i);
}
for(int k = 0; k < N; k++){
for(int j = 1; j < zarojel.size(); j++)
{
if(zarojel.at(j-1) == '(' and zarojel.at(j) == ')')
{
zarojel.erase(zarojel.begin()+j-1,zarojel.begin()+j+1);
sorszam.erase(sorszam.begin()+j-1,sorszam.begin()+j+1);
}
}
}
cout << zarojel.size()/2 << endl;
if(zarojel.size() != 0)
{
for(int i = 0; i < zarojel.size()/2; i++)
{
char a = zarojel.at(i);
for(int j = 0; j < zarojel.size(); j++)
{
char b = zarojel.at(j);
if(a != b)
{
cout << sorszam.at(i) << " " << sorszam.at(j) << endl;
break;
}
}
}
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Wrong answer | 3ms | 2004 KiB | ||||
3 | Accepted | 3ms | 2216 KiB | ||||
subtask2 | 0/33 | ||||||
4 | Wrong answer | 3ms | 2476 KiB | ||||
5 | Accepted | 2ms | 2492 KiB | ||||
6 | Wrong answer | 2ms | 2492 KiB | ||||
subtask3 | 0/44 | ||||||
7 | Wrong answer | 3ms | 2504 KiB | ||||
8 | Wrong answer | 9ms | 2556 KiB | ||||
9 | Wrong answer | 3ms | 2772 KiB | ||||
10 | Wrong answer | 3ms | 3144 KiB | ||||
11 | Wrong answer | 4ms | 3100 KiB | ||||
12 | Wrong answer | 3ms | 3096 KiB | ||||
subtask4 | 0/23 | ||||||
13 | Time limit exceeded | 1.1s | 5136 KiB | ||||
14 | Time limit exceeded | 1.044s | 5352 KiB | ||||
15 | Time limit exceeded | 1.047s | 5476 KiB | ||||
16 | Time limit exceeded | 1.042s | 8160 KiB | ||||
17 | Time limit exceeded | 1.078s | 8160 KiB | ||||
18 | Time limit exceeded | 1.077s | 8356 KiB | ||||
19 | Time limit exceeded | 1.07s | 8192 KiB | ||||
20 | Time limit exceeded | 1.057s | 8180 KiB | ||||
21 | Time limit exceeded | 1.072s | 8452 KiB | ||||
22 | Time limit exceeded | 1.072s | 8436 KiB | ||||
23 | Time limit exceeded | 1.044s | 8544 KiB | ||||
24 | Time limit exceeded | 1.075s | 8552 KiB |