結果

問題 No.150 "良問"(良問とは言っていない
ユーザー convexineqconvexineq
提出日時 2020-12-10 08:13:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 356 ms / 5,000 ms
コード長 334 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 81,496 KB
実行使用メモリ 77,072 KB
最終ジャッジ日時 2023-10-19 19:45:01
合計ジャッジ時間 4,541 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
76,076 KB
testcase_01 AC 38 ms
53,348 KB
testcase_02 AC 38 ms
53,348 KB
testcase_03 AC 39 ms
53,348 KB
testcase_04 AC 38 ms
53,348 KB
testcase_05 AC 79 ms
75,836 KB
testcase_06 AC 356 ms
77,072 KB
testcase_07 AC 38 ms
53,352 KB
testcase_08 AC 62 ms
70,476 KB
testcase_09 AC 54 ms
63,648 KB
testcase_10 AC 151 ms
76,152 KB
testcase_11 AC 166 ms
76,272 KB
testcase_12 AC 140 ms
76,128 KB
testcase_13 AC 167 ms
76,992 KB
testcase_14 AC 180 ms
76,284 KB
testcase_15 AC 172 ms
76,188 KB
testcase_16 AC 93 ms
75,936 KB
testcase_17 AC 123 ms
76,420 KB
testcase_18 AC 172 ms
76,220 KB
testcase_19 AC 188 ms
76,740 KB
testcase_20 AC 189 ms
76,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
good  ="good"
problem = "problem"
for _ in range(T):
    s = input()
    L = len(s)
    ans = 11
    for i in range(L):
        v = sum(si!=sj for si,sj in zip(good,s[i:i+4]))
        for j in range(i+4,L-6):
            w = sum(si!=sj for si,sj in zip(problem,s[j:j+7]))
            ans = min(ans,v+w)
    print(ans)
0