結果

問題 No.150 "良問"(良問とは言っていない
ユーザー 👑 KazunKazun
提出日時 2021-02-07 18:56:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 260 ms / 5,000 ms
コード長 407 bytes
コンパイル時間 1,746 ms
コンパイル使用メモリ 86,248 KB
実行使用メモリ 77,960 KB
最終ジャッジ日時 2023-09-17 17:14:33
合計ジャッジ時間 5,382 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
77,252 KB
testcase_01 AC 75 ms
70,992 KB
testcase_02 AC 76 ms
71,316 KB
testcase_03 AC 78 ms
71,100 KB
testcase_04 AC 74 ms
71,208 KB
testcase_05 AC 92 ms
76,400 KB
testcase_06 AC 260 ms
77,960 KB
testcase_07 AC 76 ms
71,336 KB
testcase_08 AC 88 ms
76,320 KB
testcase_09 AC 82 ms
75,180 KB
testcase_10 AC 132 ms
77,364 KB
testcase_11 AC 138 ms
77,052 KB
testcase_12 AC 128 ms
77,220 KB
testcase_13 AC 136 ms
77,368 KB
testcase_14 AC 155 ms
77,788 KB
testcase_15 AC 138 ms
77,036 KB
testcase_16 AC 99 ms
77,636 KB
testcase_17 AC 119 ms
77,380 KB
testcase_18 AC 140 ms
77,112 KB
testcase_19 AC 160 ms
77,304 KB
testcase_20 AC 156 ms
77,272 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
#================================================
T=int(input())
for _ in range(T):
    S=input()
    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