# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
645602 | Pety | Homework (CEOI22_homework) | C++14 | 215 ms | 209576 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>
#define ll long long
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
string s;
vector<vector<int>>v;
struct subarbore {
int st, dr, cnt;
};
subarbore rec (int st, int dr, int l) {
if (st + 1 == dr) {
return {1, 1, 1};
}
int mid = *lower_bound(v[l - 1].begin(), v[l - 1].end(), st);
subarbore a = rec(st + 4, mid, l + 1);
subarbore b = rec(mid + 1, dr - 1, l + 1);
if (s[st + 1] == 'a') {
return {a.st + b.st, max(a.dr + b.cnt, b.dr + a.cnt), a.cnt + b.cnt};
}
else {
a.st = a.cnt - a.st + 1;
a.dr = a.cnt - a.dr + 1;
b.st = b.cnt - b.st + 1;
b.dr = b.cnt - b.dr + 1;
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |