結果
問題 | No.252 "良問"(良問とは言っていない (2) |
ユーザー |
![]() |
提出日時 | 2023-10-03 20:19:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 549 ms / 2,000 ms |
コード長 | 943 bytes |
コンパイル時間 | 361 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 124,624 KB |
最終ジャッジ日時 | 2024-07-26 14:10:10 |
合計ジャッジ時間 | 4,511 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
import sysinput = sys.stdin.readlineM = int(input())for _ in range(M):S = list(input())N = len(S)T = [0] * 8problem = "problem"for i in range(4, N - 7):cnt = 0for j in range(7):cnt += int(S[i + j] != problem[j])T[cnt] += 1ans = 10 ** 18good = "good"problem_cnt = 0for i in range(N - 11):cnt = problem_cntfor j in range(4):cnt += int(S[i + j] != good[j])temp = 10 ** 18for j in range(8):if T[j]:temp = jbreakans = min(ans, cnt + temp)cnt = 0for j in range(7):if i + 4 + j >= N:breakcnt += int(S[i + 4 + j] != problem[j])T[cnt] -= 1if i >= 6:if S[i-6:i+1] == list(problem):problem_cnt += 1print(ans)