| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1323919 | itslq | Homework (CEOI22_homework) | C++20 | 218 ms | 122776 KiB |
#include <bits/stdc++.h>
using namespace std;
int ind = 0, N = 0;
string S;
struct node {
node *lc, *rc;
int op = 0, l, r; // 0 = ?, 1 = min, 2 = max
node() {
if (S[ind] == 'm') {
op = (S[++ind] == 'i') ? 1 : 2;
ind += 3;
lc = new node();
rc = new node();
ind++;
} else {
N++;
ind += 2;
}
}
void solve() {
if (op == 0) {
l = 1;
r = N;
return;
}
lc -> solve();
rc -> solve();
if (op == 1) {
l = min(lc -> l, rc -> l);
r = min(lc -> r, rc -> r) - 1;
} else {
l = max(lc -> l, rc -> l) + 1;
r = max(lc -> r, rc -> r);
}
}
} *root;
int main() {
cin >> S;
root = new node();
root -> solve();
cout << (root -> r) - (root -> l) + 1;
}| # | 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... | ||||
