結果

問題 No.291 黒い文字列
ユーザー lam6er
提出日時 2025-04-16 16:41:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 556 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 81,744 KB
実行使用メモリ 57,984 KB
最終ジャッジ日時 2025-04-16 16:42:01
合計ジャッジ時間 2,014 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 18 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input().strip()
n = len(s)
used = [False] * n
target = ['K', 'U', 'R', 'O', 'I']
count = 0

while True:
    ptr = 0
    indices = []
    for c in target:
        found = False
        while ptr < n:
            if not used[ptr] and (s[ptr] == c or s[ptr] == '?'):
                indices.append(ptr)
                used[ptr] = True
                ptr += 1
                found = True
                break
            ptr += 1
        if not found:
            break
    if len(indices) == 5:
        count += 1
    else:
        break

print(count)
0