Submission #2202552


Source Code Expand

Copy
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s; cin >> s;
  int i = s.length() - 1;
  while(i>=4) {
    if(i >= 5 && s.substr(i-5, 6) == "eraser") i -= 6;
    else if(s.substr(i-4, 5) == "erase") i -= 5;
    else if(i >= 6 && s.substr(i-6, 7) == "dreamer") i -= 7;
    else if(s.substr(i-4, 5) == "dream") i -= 5;
    else break;
  }
  if(i == -1) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Submission Info

Submission Time
Task ABC049C - 白昼夢 / Daydream
User nenuon
Language C++14 (GCC 5.4.1)
Score 300
Code Size 956 Byte
Status
Exec Time 6 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 4 ms 512 KB
subtask1_1.txt 3 ms 512 KB
subtask1_10.txt 5 ms 512 KB
subtask1_11.txt 4 ms 512 KB
subtask1_12.txt 4 ms 512 KB
subtask1_13.txt 5 ms 512 KB
subtask1_14.txt 3 ms 512 KB
subtask1_15.txt 3 ms 512 KB
subtask1_2.txt 2 ms 512 KB
subtask1_3.txt 4 ms 512 KB
subtask1_4.txt 6 ms 512 KB
subtask1_5.txt 4 ms 512 KB
subtask1_6.txt 4 ms 512 KB
subtask1_7.txt 4 ms 512 KB
subtask1_8.txt 4 ms 512 KB
subtask1_9.txt 4 ms 512 KB