結果
| 問題 | No.3290 Encrypt Failed, but Decrypt Succeeded |
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2025-10-03 22:04:00 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 682 bytes |
| 記録 | |
| コンパイル時間 | 249 ms |
| コンパイル使用メモリ | 95,852 KB |
| 実行使用メモリ | 1,341,144 KB |
| 最終ジャッジ日時 | 2026-07-15 09:29:13 |
| 合計ジャッジ時間 | 12,341 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 RE * 1 MLE * 10 -- * 5 |
ソースコード
N,K=map(int,input().split())
t = input()
inf = 10**18
dp = [0 for _ in range(N+1)]
dp[-1] = 1
for i in range(N-1,-1,-1):
if t[i] == "0":
continue
if i+2<=N and int(t[i]+t[i+1])<=26:
dp[i] += dp[i+2]
dp[i] += dp[i+1]
# 最初から決める
i = 0
ans=[]
while i < N:
if i+2 <= N and t[i+1] == "0":
ans.append(int(t[i]+t[i+1]))
i+=2
if i+2<=N and int(t[i]+t[i+1])<=26:
if dp[i+1] < K:
K-=dp[i+1]
ans.append(int(t[i]+t[i+1]))
i+=2
else:
ans.append(int(t[i]))
i+=1
else:
ans.append(int(t[i]))
i+=1
print("".join([chr(96+a) for a in ans]))
nikoro256