10435 | 2024-04-02 13:20:25 | 111 | Zárójel csere | cpp17 | Wrong answer 0/100 | 59ms | 22316 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin>>N;
string S;
cin>>S;
deque<int>a,b;
int i=0,x=0,y=0;
for(char c:S){
if(c=='('){
x++;
a.push_back(i);
}
else{
x--;
b.push_back(i);
}
y=max(y,-x);
i++;
}
cout<<y<<'\n';
y=(y+1)/2;
while(y--){
cout<<a.back()<<' '<<b.front()<<'\n';
a.pop_back();
b.pop_front();
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1824 KiB | ||||
2 | Wrong answer | 3ms | 2056 KiB | ||||
3 | Accepted | 3ms | 2248 KiB | ||||
subtask2 | 0/33 | ||||||
4 | Wrong answer | 3ms | 2480 KiB | ||||
5 | Accepted | 3ms | 2696 KiB | ||||
6 | Wrong answer | 3ms | 2888 KiB | ||||
subtask3 | 0/44 | ||||||
7 | Wrong answer | 3ms | 3092 KiB | ||||
8 | Wrong answer | 3ms | 3460 KiB | ||||
9 | Wrong answer | 3ms | 3400 KiB | ||||
10 | Wrong answer | 3ms | 3232 KiB | ||||
11 | Wrong answer | 3ms | 3488 KiB | ||||
12 | Wrong answer | 3ms | 3576 KiB | ||||
subtask4 | 0/23 | ||||||
13 | Wrong answer | 8ms | 8944 KiB | ||||
14 | Wrong answer | 24ms | 10748 KiB | ||||
15 | Wrong answer | 8ms | 12816 KiB | ||||
16 | Wrong answer | 34ms | 14620 KiB | ||||
17 | Wrong answer | 12ms | 18212 KiB | ||||
18 | Wrong answer | 12ms | 19256 KiB | ||||
19 | Wrong answer | 12ms | 19996 KiB | ||||
20 | Wrong answer | 52ms | 21136 KiB | ||||
21 | Wrong answer | 59ms | 22064 KiB | ||||
22 | Wrong answer | 57ms | 22284 KiB | ||||
23 | Wrong answer | 54ms | 22308 KiB | ||||
24 | Wrong answer | 50ms | 22316 KiB |