結果
| 問題 | No.3290 Encrypt Failed, but Decrypt Succeeded | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-10-03 22:07:18 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 661 bytes | 
| コンパイル時間 | 300 ms | 
| コンパイル使用メモリ | 82,396 KB | 
| 実行使用メモリ | 103,272 KB | 
| 最終ジャッジ日時 | 2025-10-03 22:07:24 | 
| 合計ジャッジ時間 | 4,875 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 RE * 22 | 
ソースコード
n, k = map(int, input().split())
t = list(map(int, input()))
cnt = [-1] * (n + 1)
def solve(i):
    if cnt[i] != -1:
        return cnt[i]
    if i == n:
        cnt[i] = 1
        return 1
    if t[i] == 0:
        cnt[i] = 0
        return 0
    cnt[i] = solve(i + 1)
    if i != n - 1 and t[i] * 10 + t[i + 1] <= 26:
        cnt[i] += solve(i + 2)
    return min(10**18 + 2525, cnt[i])
solve(0)
p = 0
k -= 1
ans = []
while p < n:
    if k < cnt[p + 1]:
        ans.append(chr(96 + t[p]))
        p += 1
    else:
        c = t[p] * 10 + t[p + 1]
        ans.append(chr(96 + c))
        k -= cnt[p + 1]
        p += 2
assert k == 0
print(*ans, sep="")
            
            
            
        