Submission #500167


Source Code Expand

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef long double ld;
typedef int ut;
typedef pair<ut,ut> pr;
typedef vector<ut> VI;
typedef vector<pr> Vpr;
const ut INF=1<<30;
const int SIZE=1e+6;
using namespace std;
int DP[6];
int main() {
	
	string s;
	cin >> s;
	bool ans=true;
	reverse(BE(s));
	REP(i,s.size()){
		if(s[i]=='h')
			DP[0]++;
		else if(s[i]=='c' && DP[0]>0){
			DP[1]++;
			DP[0]--;
		}
		else if(s[i]=='e' && DP[1]>0){
			DP[2]++;
			DP[1]--;
		}
		else if(s[i]=='t' && DP[2]>0){
			DP[3]++;
			DP[2]--;
		}
		else if(s[i]=='i' && DP[3]>0){
			DP[4]++;
			DP[3]--;
		}
		else if(s[i]=='t' && DP[4]>0){
			DP[4]--;
		}
		else{
			ans=false;
		}
	}
	REP(i,5)
		if(DP[i]) ans=false;
	if(ans) cout <<"Yes" << endl;
	else cout << "No" << endl;
	// your code goes here
	return 0;
}

Submission Info

Submission Time
Task G - titech分離
User anct
Language C++11 (GCC 4.9.2)
Score 100
Code Size 997 Byte
Status AC
Exec Time 29 ms
Memory 928 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 4
AC × 59
Set Name Test Cases
Sample 00-example1.txt, 00-example2.txt, 00-example3.txt, 00-example4.txt
All 00-example1.txt, 00-example2.txt, 00-example3.txt, 00-example4.txt, 01-hand00.txt, 01-hand01.txt, 01-hand02.txt, 01-hand03.txt, 01-hand04.txt, 01-hand05.txt, 01-hand06.txt, 01-hand07.txt, 01-hand08.txt, 01-hand09.txt, 10-randomA00.txt, 10-randomA01.txt, 10-randomA02.txt, 10-randomA03.txt, 10-randomA04.txt, 10-randomA05.txt, 10-randomA06.txt, 10-randomA07.txt, 10-randomA08.txt, 10-randomA09.txt, 10-randomA10.txt, 10-randomA11.txt, 10-randomA12.txt, 10-randomA13.txt, 10-randomA14.txt, 20-randomB00.txt, 20-randomB01.txt, 20-randomB02.txt, 20-randomB03.txt, 20-randomB04.txt, 20-randomB05.txt, 20-randomB06.txt, 20-randomB07.txt, 20-randomB08.txt, 20-randomB09.txt, 20-randomB10.txt, 20-randomB11.txt, 20-randomB12.txt, 20-randomB13.txt, 20-randomB14.txt, 25-randomC00.txt, 25-randomC01.txt, 25-randomC02.txt, 25-randomC03.txt, 25-randomC04.txt, 25-randomC05.txt, 25-randomC06.txt, 25-randomC07.txt, 25-randomC08.txt, 25-randomC09.txt, 30-special00.txt, 30-special01.txt, 30-special02.txt, 30-special03.txt, 30-special04.txt
Case Name Status Exec Time Memory
00-example1.txt AC 27 ms 800 KiB
00-example2.txt AC 27 ms 920 KiB
00-example3.txt AC 26 ms 920 KiB
00-example4.txt AC 27 ms 804 KiB
01-hand00.txt AC 26 ms 728 KiB
01-hand01.txt AC 26 ms 916 KiB
01-hand02.txt AC 25 ms 796 KiB
01-hand03.txt AC 26 ms 920 KiB
01-hand04.txt AC 27 ms 920 KiB
01-hand05.txt AC 26 ms 924 KiB
01-hand06.txt AC 25 ms 796 KiB
01-hand07.txt AC 27 ms 808 KiB
01-hand08.txt AC 26 ms 804 KiB
01-hand09.txt AC 25 ms 804 KiB
10-randomA00.txt AC 26 ms 796 KiB
10-randomA01.txt AC 25 ms 800 KiB
10-randomA02.txt AC 26 ms 780 KiB
10-randomA03.txt AC 26 ms 928 KiB
10-randomA04.txt AC 28 ms 928 KiB
10-randomA05.txt AC 26 ms 800 KiB
10-randomA06.txt AC 26 ms 800 KiB
10-randomA07.txt AC 26 ms 924 KiB
10-randomA08.txt AC 26 ms 808 KiB
10-randomA09.txt AC 27 ms 704 KiB
10-randomA10.txt AC 26 ms 800 KiB
10-randomA11.txt AC 24 ms 796 KiB
10-randomA12.txt AC 26 ms 920 KiB
10-randomA13.txt AC 26 ms 796 KiB
10-randomA14.txt AC 27 ms 928 KiB
20-randomB00.txt AC 25 ms 928 KiB
20-randomB01.txt AC 27 ms 800 KiB
20-randomB02.txt AC 25 ms 928 KiB
20-randomB03.txt AC 26 ms 808 KiB
20-randomB04.txt AC 25 ms 920 KiB
20-randomB05.txt AC 29 ms 800 KiB
20-randomB06.txt AC 27 ms 920 KiB
20-randomB07.txt AC 26 ms 804 KiB
20-randomB08.txt AC 27 ms 792 KiB
20-randomB09.txt AC 25 ms 924 KiB
20-randomB10.txt AC 26 ms 800 KiB
20-randomB11.txt AC 26 ms 804 KiB
20-randomB12.txt AC 25 ms 800 KiB
20-randomB13.txt AC 26 ms 804 KiB
20-randomB14.txt AC 27 ms 924 KiB
25-randomC00.txt AC 26 ms 804 KiB
25-randomC01.txt AC 27 ms 840 KiB
25-randomC02.txt AC 26 ms 800 KiB
25-randomC03.txt AC 26 ms 928 KiB
25-randomC04.txt AC 26 ms 808 KiB
25-randomC05.txt AC 27 ms 800 KiB
25-randomC06.txt AC 26 ms 804 KiB
25-randomC07.txt AC 26 ms 804 KiB
25-randomC08.txt AC 25 ms 800 KiB
25-randomC09.txt AC 26 ms 924 KiB
30-special00.txt AC 27 ms 792 KiB
30-special01.txt AC 24 ms 924 KiB
30-special02.txt AC 25 ms 916 KiB
30-special03.txt AC 26 ms 792 KiB
30-special04.txt AC 26 ms 792 KiB