Submission #2202604


Source Code Expand

Copy
#include <iostream>
#include <string>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

#define FOR(var,start,end) for(int var=start; var<end; var++)
#define REP(var,cnt) FOR(var,0,cnt)

int main(void) {


	string str;
	cin >> str;
	
	while ( str.length() ) {
		if ( str.length() >= 7 ) {
			if ( str.substr( str.length()-7 ) == "dreamer" ) {
				str = str.substr(0, str.length()-7);
				continue;
			}
		}
		if ( str.length() >= 6 ) {
			if ( str.substr( str.length()-6 ) == "eraser" ) {
				str = str.substr(0, str.length()-6);
				continue;
			}
		}
		
		if ( str.length() >= 5 ) {
			if ( str.substr( str.length()-5 ) == "dream" ) {
				str = str.substr(0, str.length()-5);
				continue;
			}
			if ( str.substr( str.length()-5 ) == "erase" ) {
				str = str.substr(0, str.length()-5);
				continue;
			}
		}
		
		cout << "NO" << endl;
		return 0;
	}
	
	cout << "YES" << endl;
}

Submission Info

Submission Time
Task ABC049C - 白昼夢 / Daydream
User yokoyama10
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1020 Byte
Status
Exec Time 54 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 47 ms 512 KB
subtask1_1.txt 44 ms 512 KB
subtask1_10.txt 53 ms 512 KB
subtask1_11.txt 52 ms 512 KB
subtask1_12.txt 52 ms 512 KB
subtask1_13.txt 54 ms 512 KB
subtask1_14.txt 35 ms 512 KB
subtask1_15.txt 45 ms 512 KB
subtask1_2.txt 20 ms 512 KB
subtask1_3.txt 50 ms 512 KB
subtask1_4.txt 51 ms 512 KB
subtask1_5.txt 52 ms 512 KB
subtask1_6.txt 53 ms 512 KB
subtask1_7.txt 50 ms 512 KB
subtask1_8.txt 52 ms 512 KB
subtask1_9.txt 51 ms 512 KB