Submission #800869

#TimeUsernameProblemLanguageResultExecution timeMemory
800869gun_ganHomework (CEOI22_homework)C++17
13 / 100
77 ms69008 KiB
#include <bits/stdc++.h> using namespace std; const int MX = 2e6 + 5; int N; vector<int> g[MX]; bool type[MX]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); string s; cin >> s; N = s.size(); vector<int> v; int m = 0; for(int i = 0; i < N; i++) { // cout << i << " " << s[i] << '\n'; if(s[i] == '?') { i++; m++; continue; } if(s[i] != 'm') continue; if(s[i + 1] == 'a') { v.push_back(1); i += 3; } else { v.push_back(0); i += 3; } } // cout << '\n'; reverse(v.begin(), v.end()); int l = 1, r = m; for(auto x : v) { if(x) { l++; r = m; } else { r--; l = 1; } // cout << l << " " << r << " " << x << '\n'; } cout << r - l + 1 << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...