# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
511451 | CodeTiger927 | Match (CEOI16_match) | C++17 | 75 ms | 38588 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.
using namespace std;
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#define MAXN 100005
#define MOD 998244353
int N,pre0[MAXN],pre1[MAXN],mask[MAXN];
string s;
char ans[MAXN];
map<long long,vector<int>> pos[26];
bool solve(int l,int r) {
if(l > r) return true;
auto uwu = pos[s[l] - 'a'][mask[l]];
auto it = upper_bound(uwu.begin(),uwu.end(),r);
if(it == uwu.begin() || *prev(it) <= l) return false;
int owo = *prev(it);
// cout << l << " " << owo << endl;
ans[l] = '(';
ans[owo] = ')';
if(l == r - 1) return true;
return solve(l + 1,owo - 1) & solve(owo + 1,r);
}
int main() {
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... |