結果
問題 | No.996 Phnom Penh |
ユーザー | titia |
提出日時 | 2020-02-21 23:22:47 |
言語 | Python3 (3.11.6 + numpy 1.26.0 + scipy 1.11.3) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,489 bytes |
コンパイル時間 | 308 ms |
コンパイル使用メモリ | 10,804 KB |
実行使用メモリ | 8,616 KB |
最終ジャッジ日時 | 2023-07-30 08:07:04 |
合計ジャッジ時間 | 3,237 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
8,076 KB |
testcase_01 | AC | 16 ms
8,060 KB |
testcase_02 | AC | 16 ms
8,100 KB |
testcase_03 | AC | 16 ms
8,064 KB |
testcase_04 | AC | 16 ms
8,076 KB |
testcase_05 | AC | 17 ms
8,056 KB |
testcase_06 | AC | 16 ms
8,068 KB |
testcase_07 | AC | 17 ms
8,104 KB |
testcase_08 | AC | 17 ms
8,012 KB |
testcase_09 | AC | 16 ms
8,064 KB |
testcase_10 | AC | 16 ms
8,032 KB |
testcase_11 | AC | 16 ms
8,044 KB |
testcase_12 | AC | 17 ms
8,208 KB |
testcase_13 | WA | - |
testcase_14 | AC | 137 ms
8,424 KB |
testcase_15 | WA | - |
testcase_16 | AC | 137 ms
8,456 KB |
testcase_17 | AC | 141 ms
8,560 KB |
testcase_18 | AC | 15 ms
7,972 KB |
testcase_19 | WA | - |
testcase_20 | AC | 16 ms
8,108 KB |
testcase_21 | AC | 16 ms
8,032 KB |
testcase_22 | AC | 16 ms
8,104 KB |
testcase_23 | WA | - |
testcase_24 | AC | 181 ms
8,460 KB |
testcase_25 | AC | 194 ms
8,492 KB |
testcase_26 | AC | 212 ms
8,500 KB |
testcase_27 | AC | 186 ms
8,616 KB |
ソースコード
S=input() LEN=len(S) S+="z"*100 D1=[] D2=[] for i in range(LEN): if S[i:i+3]=="phn": ind=i+3 count=0 while True: if S[ind]=="h" or S[ind]=="e": ind+=1 elif count%2==0 and S[ind]=="o": ind+=1 count+=1 elif count%2==1 and S[ind]=="m": ind+=1 count+=1 else: break #print(i,ind) D1.append(count//2) for i in range(LEN): if S[i:i+2]=="om": ind=i-1 while ind>=0 and S[ind]=="h": ind-=1 #print(i,ind) if S[ind-2:ind+1]=="pen": ind2=i count=0 while True: if S[ind2]=="h" or S[ind2]=="e": ind2+=1 elif count%2==0 and S[ind2]=="o": ind2+=1 count+=1 elif count%2==1 and S[ind2]=="m": ind2+=1 count+=1 else: break D2.append(count//2) if D1==[] and D2==[]: if "e" in S: print(2) elif "h" in S: print(1) else: print(0) else: if D2==[]: print(sum(D1)+max(D1)+1) elif D1==[]: print(sum(D2)+max(D2)+2) else: if max(D1)>max(D2): print(sum(D1)+sum(D2)+max(D1)+1) else: print(sum(D1)+sum(D2)+max(D2)+2)