結果

問題 No.996 Phnom Penh
ユーザー Y17Y17
提出日時 2020-02-21 23:18:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 722 bytes
コンパイル時間 1,758 ms
コンパイル使用メモリ 159,180 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 09:20:27
合計ジャッジ時間 15,263 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
5,376 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
	string s;
	cin >> s;
	int n = s.size();
	s +="USHITAPUNICHIAKUN";

	int zone;
	int ans = 0;
	int e = 0;
	for(int i = 0;i < n;i++){
		if(s[i] == 'p' && s[i+1] == 'h' && s[i+2] == 'n'){
			zone = 0;
			for(int j = i+3;j < n;j += 2){
				if(s[j] == 'o' && s[j+1] == 'm'){
					zone++;
				}
			}
			ans = max(ans, zone*2+1);
		}
		
		if(s[i] == 'e' && s[i] == 'h') ans = max(ans, 1ll);

		if(s[i] == 'p' && s[i+1] == 'e' && s[i+2] == 'n' && s[i+3] == 'h'){
			zone = 0;
			for(int j = i+4;j < n;j += 2){
				if(s[j] == 'o' && s[j+1] == 'm'){
					zone++;
				}
			}
			ans = max(ans, zone*2+2);
		}
	}

	cout << ans << endl;

	return 0;
}
0