# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
444263 | prvocislo | 괄호 문자열 (CEOI16_match) | C++17 | 24 ms | 15452 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |