#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
16 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
17 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
18 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
19 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
20 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
21 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
22 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
23 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
24 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
25 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
26 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
27 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
28 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
29 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
30 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
33 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
34 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
35 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
36 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
2016 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2308 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
2308 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
2308 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
2464 KB |
Output isn't correct |
5 |
Incorrect |
3 ms |
2464 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
2464 KB |
Output isn't correct |
7 |
Incorrect |
3 ms |
2464 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
2464 KB |
Output isn't correct |
9 |
Incorrect |
3 ms |
2464 KB |
Output isn't correct |
10 |
Incorrect |
3 ms |
2464 KB |
Output isn't correct |
11 |
Incorrect |
3 ms |
2464 KB |
Output isn't correct |
12 |
Incorrect |
3 ms |
2464 KB |
Output isn't correct |
13 |
Incorrect |
3 ms |
2464 KB |
Output isn't correct |
14 |
Incorrect |
3 ms |
2464 KB |
Output isn't correct |
15 |
Incorrect |
3 ms |
2464 KB |
Output isn't correct |
16 |
Incorrect |
3 ms |
2308 KB |
Output isn't correct |
17 |
Incorrect |
3 ms |
2308 KB |
Output isn't correct |
18 |
Incorrect |
3 ms |
2308 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
2308 KB |
Output isn't correct |
20 |
Incorrect |
0 ms |
2308 KB |
Output isn't correct |