# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
242457 | dolphingarlic | Vim (BOI13_vim) | C++14 | 36 ms | 22912 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;
bool underlined[70000];
int t[70000], p[70000][10], q[70000][10][10];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, t_cnt = 0, e_cnt = 0;
string s;
cin >> n >> s;
underlined[0] = true;
t[t_cnt++] = s[0] - 'a' - (s[0] > 'e');
FOR(i, 1, n) {
if (s[i] != 'e') {
if (s[i - 1] == 'e') underlined[t_cnt] = true;
t[t_cnt++] = s[i] - 'a' - (s[i] > 'e');
} else e_cnt++;
}
memset(q[0], 0x3f, sizeof q[0]);
FOR(c, 0, 10) p[0][c] = (c == t[0] ? 0 : 2);
FOR(i, 0, t_cnt) {
FOR(c, 0, 10) {
p[i + 1][c] = min(p[i][t[i]], q[i][t[i]][t[i]]) + 2;
if (c != t[i]) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |