結果
| 問題 |
No.996 Phnom Penh
|
| コンテスト | |
| ユーザー |
plin92793134
|
| 提出日時 | 2020-02-23 14:52:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,541 bytes |
| コンパイル時間 | 1,023 ms |
| コンパイル使用メモリ | 103,428 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-10 01:58:45 |
| 合計ジャッジ時間 | 2,305 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 WA * 22 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)
#define all(x) (x).begin(),(x).end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
string s,ns;cin>>s;
string phn="phn",penh="penh",om="om";
ll res=0;
rep(i,s.length()){
if(s[i]=='e')res=2;
if(s[i]=='h')chmax(res,1ll);
}
auto cntom=[&](ll id){
ll l=s.length();
ll nid=id;
ll tot=0;
while(nid+1<l){
if(s.substr(nid,2)==om){
tot++;
nid+=2;
}
else break;
}
return tot;
};
auto op12=[&]{
ns="";
bool f=0;
ll l=s.length();
rep(i,l){
if(i+2<l&&s.substr(i,3)==phn){
chmax(res,cntom(i+3)*2+1);
}
if(i+3<l&&s.substr(i,4)==penh){
chmax(res,cntom(i+4)*2+2);
}
}
return f;
};
op12();
cout<<res<<endl;
return 0;
}
plin92793134