# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
444263 | prvocislo | Match (CEOI16_match) | C++17 | 24 ms | 15452 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>
typedef long long ll;
using namespace std;
void add(vector<char> &st, char c)
{
if (!st.empty() && st.back() == c) st.pop_back();
else st.push_back(c);
}
const int maxn = 1e5 + 5, abc = 26;
//const int maxn = 15, abc = 2;
vector<vector<int> > pv(maxn, vector<int>(abc, -1));
string ans, s;
void rek(int l, int r) // vratane
{
if (l > r) return;
int m = pv[r][s[l]-'a'];
assert(l < m);
ans[l] = '(', ans[m] = ')';
rek(l+1, m-1), rek(m+1, r);
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> s;
int n = s.size();
vector<char> st;
for (int i = 0; i < n; i++)
add(st, s[i]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |