Submission #35311

#TimeUsernameProblemLanguageResultExecution timeMemory
35311polingyVim (BOI13_vim)C++14
0 / 100
3 ms2464 KiB
#include <cstdio> #include <cstdlib> #include <cstring> #include <cassert> #include <cmath> #include <climits> #include <sstream> #include <iostream> #include <iomanip> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <queue> #include <stack> #include <utility> #include <vector> #include <functional> #include <algorithm> using namespace std; typedef long double ld; typedef long long ll; typedef pair <int, int> pii; typedef pair <ll, ll> pll; const int inf = 1e7 + 42; int main() { int N; cin >> N; string inp; cin >> inp; vector<int> ees; bool curry = 0; for (int i = 1; i < N; ++i) { if (inp[i] == 'e') { curry = true; } else if (inp[i] != 'e' && curry) { ees.push_back(i); curry = false; } } int ans = 0; reverse(ees.begin(), ees.end()); int cp = inf; for (auto &x : ees) { int cost = min(1, cp - x); ans += 2 * cost; for (int i = x - 1; i >= 1 && inp[i] == 'e'; --i) { ans += 2; cp = i; } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...