# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41767 | top34051 | Zagrade (COI17_zagrade) | C++14 | 573 ms | 82100 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
const int maxn = 3e5 + 5;
int n;
char s[maxn];
int sz[maxn], cen[maxn];
vector<int> way[maxn];
long long ans;
int cnt[2][maxn];
void dfs(int t, int u, int last, int cur, int mx, vector<int> &vec) {
if(t==0) cur += s[u]=='(' ? 1 : -1;
else cur += s[u]=='(' ? -1 : 1;
mx = max(mx, cur);
if(cur==mx) vec.pb(cur);
for(auto v : way[u]) {
if(v==last || cen[v]) continue;
dfs(t,v,u,cur,mx,vec);
}
}
void solve(int u) {
int t = s[u]=='(' ? -1 : 1;
vector<int> L, R;
for(auto v : way[u]) {
if(cen[v]) continue;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |