結果
| 問題 |
No.3290 Encrypt Failed, but Decrypt Succeeded
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-05 20:16:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,087 bytes |
| コンパイル時間 | 4,390 ms |
| コンパイル使用メモリ | 82,276 KB |
| 実行使用メモリ | 813,704 KB |
| 最終ジャッジ日時 | 2025-10-05 20:17:00 |
| 合計ジャッジ時間 | 4,449 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 MLE * 1 -- * 16 |
ソースコード
from string import ascii_lowercase
import sys
import os
IS_LOCAL = os.environ.get("LOCAL") == "true"
def debug(*args, sep=" ", end="\n", flush=False) -> None:
if IS_LOCAL:
print(*args, sep=sep, end=end, file=sys.stderr, flush=flush)
def yn(flg: bool) -> bool:
print('Yes' if flg else 'No')
return flg
def main():
readline = sys.stdin.readline
N, K = map(int, readline().split())
K -= 1
S = readline().strip()
dp = [0] * (N + 1)
dp[N] = 1
for i in range(N - 1, -1, -1):
c = int(S[i])
if c == 0:
continue
dp[i] = dp[i + 1]
if c <= 2 and i + 1 < N and 1 <= int(S[i:i + 2]) <= 26:
dp[i] += dp[i + 2]
debug(dp)
ans = []
i = 0
while i < N:
c = int(S[i])
if c <= 2 and i + 1 < N and 1 <= int(S[i:i + 2]) <= 26 and K >= dp[i + 1]:
K -= dp[i + 1]
c = int(S[i:i + 2])
i += 2
else:
i += 1
ans.append(ascii_lowercase[c - 1])
print("".join(ans))
if __name__ == "__main__":
main()