結果

問題 No.1609 String Division Machine
ユーザー 👑 rin204rin204
提出日時 2022-01-18 01:37:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 1,002 ms
コンパイル使用メモリ 86,688 KB
実行使用メモリ 89,264 KB
最終ジャッジ日時 2023-08-15 07:13:14
合計ジャッジ時間 6,874 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,020 KB
testcase_01 AC 74 ms
71,108 KB
testcase_02 AC 74 ms
71,228 KB
testcase_03 AC 74 ms
70,832 KB
testcase_04 AC 75 ms
71,168 KB
testcase_05 AC 73 ms
71,144 KB
testcase_06 AC 74 ms
70,884 KB
testcase_07 AC 76 ms
75,264 KB
testcase_08 AC 75 ms
71,048 KB
testcase_09 AC 73 ms
71,212 KB
testcase_10 AC 73 ms
70,764 KB
testcase_11 AC 75 ms
71,084 KB
testcase_12 AC 75 ms
70,920 KB
testcase_13 AC 75 ms
71,060 KB
testcase_14 AC 79 ms
75,356 KB
testcase_15 AC 76 ms
71,064 KB
testcase_16 AC 78 ms
71,060 KB
testcase_17 AC 76 ms
71,124 KB
testcase_18 AC 76 ms
71,044 KB
testcase_19 AC 78 ms
75,280 KB
testcase_20 AC 79 ms
75,380 KB
testcase_21 AC 75 ms
71,112 KB
testcase_22 AC 79 ms
75,320 KB
testcase_23 AC 84 ms
76,152 KB
testcase_24 AC 86 ms
76,076 KB
testcase_25 AC 85 ms
76,132 KB
testcase_26 AC 84 ms
75,752 KB
testcase_27 AC 84 ms
75,884 KB
testcase_28 AC 85 ms
76,088 KB
testcase_29 AC 84 ms
76,096 KB
testcase_30 AC 84 ms
75,736 KB
testcase_31 AC 85 ms
76,172 KB
testcase_32 AC 86 ms
76,112 KB
testcase_33 AC 144 ms
84,220 KB
testcase_34 AC 151 ms
85,540 KB
testcase_35 AC 161 ms
86,036 KB
testcase_36 AC 144 ms
84,548 KB
testcase_37 AC 158 ms
85,576 KB
testcase_38 AC 106 ms
82,416 KB
testcase_39 AC 107 ms
82,640 KB
testcase_40 AC 160 ms
89,264 KB
testcase_41 AC 110 ms
82,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
n = len(S)

used = [False] * n
T = ["?"] * n
for i in range(n):
    if S[i] == "?":
        used[i] = True
    else:
        T[i] = S[i]
        
cnt = [0] * n
for i in range(1, 28):
    max_ = "a"
    br = True
    for j in range(n - 1, -1, -1):
        if used[j]:
            continue
        elif S[j] >= max_:
            max_ = S[j]
            used[j] = True
            cnt[j] = i
            br = False
    if br:
        break

ma = i - 1
t = "a"
for j in range(n - 1, -1, -1):
    if T[j] == "?":
        T[j] = t
    elif cnt[j] == ma:
        t = T[j]
print(*T, sep="")


0