提出 #502862


ソースコード 拡げる

#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>

#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<functional>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF 1<<30
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define ll long long
#define ull unsigned long long
vector<set<int> > s(6);
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string se;cin>>se;
	int n=se.size();
	REP(i,n){
		char c=se[i];
		if(c=='t'){
			s[0].insert(i);
		}else if(c=='i'){
			s[1].insert(i);
			if(s[0].empty()) return 0*printf("No\n");
			s[0].erase(s[0].begin());
		}else if(c=='e'){
			s[2].insert(i);
			if(s[1].empty() || s[0].empty()) return 0*printf("No\n");
			auto itr = s[0].lower_bound(*s[1].begin());
			if(itr == s[0].end()) return 0*printf("No\n");
			s[0].erase(itr);
			s[1].erase(s[1].begin());
		}else if(c=='c'){
			s[3].insert(i);
			if(s[2].empty()) return 0*printf("No\n");
			s[2].erase(s[2].begin());
		}else if(c=='h'){
			s[4].insert(i);
			if(s[3].empty()) return 0*printf("No\n");
			s[3].erase(s[3].begin());
			s[4].erase(s[4].begin());
		}else return 0*printf("No\n");
	}
// 	cout<<"FUCK"<<endl;
	REP(i,5){
		if(!s[i].empty()) return 0*printf("No\n");
	}
	cout<<"Yes"<<endl;
	 

}

提出情報

提出日時
問題 G - titech分離
ユーザ ish_774
言語 C++11 (GCC 4.9.2)
得点 100
コード長 1549 Byte
結果 AC
実行時間 36 ms
メモリ 928 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 100 / 100
結果
AC × 4
AC × 59
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
00-example1.txt AC 26 ms 800 KiB
00-example2.txt AC 26 ms 804 KiB
00-example3.txt AC 25 ms 928 KiB
00-example4.txt AC 26 ms 808 KiB
01-hand00.txt AC 26 ms 804 KiB
01-hand01.txt AC 27 ms 812 KiB
01-hand02.txt AC 27 ms 804 KiB
01-hand03.txt AC 31 ms 756 KiB
01-hand04.txt AC 26 ms 804 KiB
01-hand05.txt AC 26 ms 808 KiB
01-hand06.txt AC 25 ms 800 KiB
01-hand07.txt AC 25 ms 844 KiB
01-hand08.txt AC 26 ms 804 KiB
01-hand09.txt AC 25 ms 920 KiB
10-randomA00.txt AC 26 ms 804 KiB
10-randomA01.txt AC 26 ms 804 KiB
10-randomA02.txt AC 26 ms 800 KiB
10-randomA03.txt AC 25 ms 924 KiB
10-randomA04.txt AC 26 ms 808 KiB
10-randomA05.txt AC 26 ms 916 KiB
10-randomA06.txt AC 24 ms 800 KiB
10-randomA07.txt AC 26 ms 800 KiB
10-randomA08.txt AC 26 ms 804 KiB
10-randomA09.txt AC 26 ms 804 KiB
10-randomA10.txt AC 26 ms 804 KiB
10-randomA11.txt AC 26 ms 808 KiB
10-randomA12.txt AC 26 ms 804 KiB
10-randomA13.txt AC 36 ms 808 KiB
10-randomA14.txt AC 26 ms 800 KiB
20-randomB00.txt AC 25 ms 800 KiB
20-randomB01.txt AC 24 ms 800 KiB
20-randomB02.txt AC 27 ms 796 KiB
20-randomB03.txt AC 26 ms 796 KiB
20-randomB04.txt AC 27 ms 920 KiB
20-randomB05.txt AC 26 ms 928 KiB
20-randomB06.txt AC 25 ms 920 KiB
20-randomB07.txt AC 26 ms 792 KiB
20-randomB08.txt AC 26 ms 804 KiB
20-randomB09.txt AC 23 ms 804 KiB
20-randomB10.txt AC 25 ms 928 KiB
20-randomB11.txt AC 23 ms 808 KiB
20-randomB12.txt AC 28 ms 920 KiB
20-randomB13.txt AC 27 ms 920 KiB
20-randomB14.txt AC 28 ms 840 KiB
25-randomC00.txt AC 27 ms 916 KiB
25-randomC01.txt AC 28 ms 928 KiB
25-randomC02.txt AC 28 ms 920 KiB
25-randomC03.txt AC 28 ms 924 KiB
25-randomC04.txt AC 26 ms 916 KiB
25-randomC05.txt AC 25 ms 800 KiB
25-randomC06.txt AC 26 ms 804 KiB
25-randomC07.txt AC 26 ms 872 KiB
25-randomC08.txt AC 26 ms 800 KiB
25-randomC09.txt AC 26 ms 920 KiB
30-special00.txt AC 26 ms 796 KiB
30-special01.txt AC 25 ms 792 KiB
30-special02.txt AC 25 ms 728 KiB
30-special03.txt AC 24 ms 912 KiB
30-special04.txt AC 26 ms 812 KiB