結果
問題 | No.996 Phnom Penh |
ユーザー | maspy |
提出日時 | 2020-04-08 15:28:44 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 795 bytes |
コンパイル時間 | 303 ms |
コンパイル使用メモリ | 10,848 KB |
実行使用メモリ | 10,848 KB |
最終ジャッジ日時 | 2023-09-25 16:52:15 |
合計ジャッジ時間 | 4,047 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
7,868 KB |
testcase_01 | AC | 16 ms
7,872 KB |
testcase_02 | AC | 16 ms
7,780 KB |
testcase_03 | AC | 16 ms
7,780 KB |
testcase_04 | AC | 16 ms
7,948 KB |
testcase_05 | AC | 16 ms
7,912 KB |
testcase_06 | AC | 16 ms
7,820 KB |
testcase_07 | AC | 16 ms
7,916 KB |
testcase_08 | AC | 17 ms
7,796 KB |
testcase_09 | AC | 16 ms
7,956 KB |
testcase_10 | AC | 16 ms
7,792 KB |
testcase_11 | AC | 16 ms
7,872 KB |
testcase_12 | AC | 16 ms
7,812 KB |
testcase_13 | AC | 49 ms
10,212 KB |
testcase_14 | AC | 50 ms
10,280 KB |
testcase_15 | AC | 49 ms
10,428 KB |
testcase_16 | AC | 50 ms
10,292 KB |
testcase_17 | AC | 50 ms
10,352 KB |
testcase_18 | WA | - |
testcase_19 | AC | 18 ms
7,816 KB |
testcase_20 | AC | 16 ms
8,008 KB |
testcase_21 | AC | 15 ms
7,820 KB |
testcase_22 | AC | 16 ms
7,880 KB |
testcase_23 | AC | 16 ms
7,916 KB |
testcase_24 | WA | - |
testcase_25 | AC | 58 ms
10,848 KB |
testcase_26 | AC | 49 ms
9,992 KB |
testcase_27 | AC | 57 ms
10,820 KB |
ソースコード
#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines S = read().rstrip().decode() op1 = S.count('phnom') S = S.replace('phnom', 'penh') T = S.replace('h', '').replace('e', 'h') if S == T: print(op1) exit() S = T def solve(S): assert not S.count('e') if not S.startswith('phn'): if S.count('h'): return 0, 1 else: return 0, 0 # phn + om * k -> phn S = S[3:].replace('om', 'X') k = 0 for i, x in enumerate(S): if x == 'X': k += 1 else: break return k, k + 1 op2 = 1 for x, y in map(solve, S.replace('p', ' p').split()): op1 += x if op2 < 1 + y: op2 = 1 + y print(op1 + op2)