結果
問題 | No.1609 String Division Machine |
ユーザー |
![]() |
提出日時 | 2021-11-09 01:20:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 77 ms / 2,000 ms |
コード長 | 680 bytes |
コンパイル時間 | 326 ms |
コンパイル使用メモリ | 82,688 KB |
実行使用メモリ | 70,784 KB |
最終ジャッジ日時 | 2024-11-17 05:54:41 |
合計ジャッジ時間 | 3,826 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 37 |
ソースコード
s = input() n = len(s) maxlist = ["a"] listlen = 1 lastplusind = n ans = [s[i] for i in range(n)] for i in reversed(range(n)): if ans[i] == "?": ans[i] = maxlist[-1] else: left = -1 right = listlen while right - left >= 2: mid = (right + left) // 2 if ans[i] < maxlist[mid]: left = mid else: right = mid if right == listlen: lastplusind = i maxlist.append(ans[i]) listlen += 1 else: maxlist[right] = ans[i] for i in range(lastplusind,n): if s[i] == "?": ans[i] = "a" ans=''.join(ans) print(ans)