#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
#define fs first
#define sc second
int meow = 0;
pii f() {
char c, cc;
cin >> c;
if (c == '?') {
meow++;
return {0, 0};
}
cin >> cc >> c >> c;
pii p1 = f();
cin >> c;
pii p2 = f();
if (cc=='a') return {p1.fs+p2.fs+1, min(p1.sc,p2.sc)};
else return {min(p1.fs,p2.fs), p1.sc+p2.sc+1};
}
int main () {
ios_base::sync_with_stdio(false); cin.tie(0);
pii p = f();
cout << meow - p.fs - p.sc << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
468 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
468 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
568 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
468 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
468 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |