Submission #2202573


Source Code Expand

Copy
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int l = S.length();
    while(l > 0) {
        int lr = l;
        if ((int)S.find("dream", l-5) >= 0) l -= 5;
        else if ((int)S.find("erase", l-5) >= 0) l -= 5;
        else if ((int)S.find("dreamer", l-7) >= 0) l -= 7;
        else if ((int)S.find("eraser", l-6) >= 0) l -= 6;
        else {
            cout << "NO" << endl;
            return 0;
        }
        S.erase(S.begin() + l, S.begin() + lr);
    }
    cout << "YES" << endl;


    return 0;
}

Submission Info

Submission Time
Task ABC049C - 白昼夢 / Daydream
User toame
Language C++14 (GCC 5.4.1)
Score 300
Code Size 893 Byte
Status
Exec Time 2 ms
Memory 512 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_0.txt, subtask0_1.txt, subtask0_2.txt
All 300 / 300 subtask0_0.txt, subtask0_1.txt, subtask0_2.txt, subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_2.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt
Case Name Status Exec Time Memory
subtask0_0.txt 1 ms 256 KB
subtask0_1.txt 1 ms 256 KB
subtask0_2.txt 1 ms 256 KB
subtask1_0.txt 2 ms 512 KB
subtask1_1.txt 2 ms 512 KB
subtask1_10.txt 2 ms 512 KB
subtask1_11.txt 2 ms 512 KB
subtask1_12.txt 2 ms 512 KB
subtask1_13.txt 2 ms 512 KB
subtask1_14.txt 2 ms 512 KB
subtask1_15.txt 2 ms 512 KB
subtask1_2.txt 2 ms 512 KB
subtask1_3.txt 2 ms 512 KB
subtask1_4.txt 2 ms 512 KB
subtask1_5.txt 2 ms 512 KB
subtask1_6.txt 2 ms 512 KB
subtask1_7.txt 2 ms 512 KB
subtask1_8.txt 2 ms 512 KB
subtask1_9.txt 2 ms 512 KB