結果
| 問題 | No.252 "良問"(良問とは言っていない (2) |
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-07 00:50:04 |
| 言語 | Python3 (3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
TLE
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 835 bytes |
| 記録 | |
| コンパイル時間 | 69 ms |
| コンパイル使用メモリ | 14,720 KB |
| 実行使用メモリ | 50,292 KB |
| 最終ジャッジ日時 | 2026-10-19 15:42:30 |
| 合計ジャッジ時間 | 11,823 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 TLE * 1 |
ソースコード
#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
# %%
T = int(readline())
words = np.array(list(read().rstrip()), dtype=np.int8)
# %%
def solve(S):
if S[0] == ord('\n'):
S = S[1:]
L = len(S)
P = np.zeros(L - 6, np.int32)
for i, ch in enumerate(b'problem'):
P += (S[i: L - 6 + i] != ch)
G = np.zeros(L - 4, np.int32)
for i, ch in enumerate(b'good'):
G += (S[i: L - 4 + i] != ch)
add = np.zeros_like(G)
add[7:] += (P == 0)[:-5]
np.cumsum(add, out=add)
G += add
INF = 10 ** 7
return (np.minimum.accumulate(G[:L - 10]) + P[4:]).min()
words = np.split(words, np.where(words == ord('\n'))[0])
print('\n'.join(map(str, map(solve, words))))
# %%
maspy