結果

問題 No.150 "良問"(良問とは言っていない
ユーザー 👑 KazunKazun
提出日時 2021-02-07 18:57:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 250 ms / 5,000 ms
コード長 448 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 77,848 KB
最終ジャッジ日時 2023-09-17 17:15:39
合計ジャッジ時間 3,833 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
77,320 KB
testcase_01 AC 74 ms
71,300 KB
testcase_02 AC 75 ms
71,144 KB
testcase_03 AC 76 ms
71,188 KB
testcase_04 AC 72 ms
71,288 KB
testcase_05 AC 90 ms
76,432 KB
testcase_06 AC 250 ms
77,756 KB
testcase_07 AC 74 ms
71,164 KB
testcase_08 AC 88 ms
75,896 KB
testcase_09 AC 83 ms
75,252 KB
testcase_10 AC 128 ms
77,044 KB
testcase_11 AC 136 ms
77,156 KB
testcase_12 AC 125 ms
77,144 KB
testcase_13 AC 139 ms
77,428 KB
testcase_14 AC 154 ms
77,428 KB
testcase_15 AC 137 ms
77,196 KB
testcase_16 AC 100 ms
77,580 KB
testcase_17 AC 114 ms
77,188 KB
testcase_18 AC 138 ms
77,572 KB
testcase_19 AC 150 ms
77,476 KB
testcase_20 AC 150 ms
77,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(X,Y):
    assert len(X)==len(Y)
    A=0
    for x,y in zip(X,Y):
        if x!=y:A+=1
    return A
#================================================
import sys
input=sys.stdin.readline
T=int(input())
for _ in range(T):
    S=input()[:-1]
    N=len(S)
    X=float("inf")
    for i in range(N-3):
        A=S[i:i+4]
        U=f(A,"good")
        for j in range(i+4,N-6):
            B=S[j:j+7]
            X=min(X,U+f(B,"problem"))
    print(X)
0