結果
問題 | No.996 Phnom Penh |
ユーザー | titia |
提出日時 | 2020-04-08 03:52:45 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 693 bytes |
コンパイル時間 | 91 ms |
コンパイル使用メモリ | 10,984 KB |
実行使用メモリ | 8,876 KB |
最終ジャッジ日時 | 2023-09-23 01:37:00 |
合計ジャッジ時間 | 9,235 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
7,924 KB |
testcase_01 | AC | 17 ms
7,820 KB |
testcase_02 | AC | 16 ms
7,852 KB |
testcase_03 | AC | 16 ms
7,816 KB |
testcase_04 | AC | 16 ms
7,712 KB |
testcase_05 | AC | 17 ms
7,816 KB |
testcase_06 | AC | 16 ms
7,712 KB |
testcase_07 | AC | 17 ms
7,716 KB |
testcase_08 | AC | 16 ms
7,812 KB |
testcase_09 | AC | 17 ms
7,920 KB |
testcase_10 | AC | 16 ms
7,888 KB |
testcase_11 | AC | 17 ms
7,832 KB |
testcase_12 | AC | 16 ms
7,872 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 16 ms
7,796 KB |
testcase_20 | AC | 16 ms
7,784 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 16 ms
7,880 KB |
testcase_24 | WA | - |
testcase_25 | AC | 986 ms
8,796 KB |
testcase_26 | AC | 842 ms
8,672 KB |
testcase_27 | AC | 602 ms
8,472 KB |
ソースコード
S=input() LEN=len(S) S+="z"*100 LEN=len(S) L=[] for i in range(LEN): if S[i:i+3]=="phn": s=0 j=i+3 while S[j:j+2]=="om": s+=1 j+=2 L.append(s) if L==[]: ANS=0 else: ANS=max(L)+sum(L)+1 T="" for s in S: if s=="h": continue if s=="e": T+="h" else: T+=s if S==T: print(ANS) else: L=[] for i in range(len(T)): if T[i:i+3]=="phn": s=0 j=i+3 while T[j:j+2]=="om": s+=1 j+=2 L.append(s) if L==[]: ANS2=0 else: ANS2=max(L)+sum(L)+2 print(max(ANS,ANS2))