結果

問題 No.3290 Encrypt Failed, but Decrypt Succeeded
ユーザー sasa8uyauya
提出日時 2025-10-03 22:14:45
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 438 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 80,904 KB
最終ジャッジ日時 2025-10-03 22:14:49
合計ジャッジ時間 3,901 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 RE * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

n,K=map(int,input().split())
T=input()

from functools import cache

@cache
def f(x):
  if x==n:
    return 1
  c=0
  if x+1<=n and 1<=int(T[x:x+1])<=26 and T[x]!="0":
    c+=f(x+1)
  if x+2<=n and 1<=int(T[x:x+2])<=26 and T[x]!="0":
    c+=f(x+2)
  return c

S=[]
l=0
while l<n:
  c=f(l+1)
  if K<=c:
    S+=[int(T[l:l+1])]
    l+=1
    continue
  K-=c
  c=f(l+2)
  S+=[int(T[l:l+2])]
  l+=2

print("".join(chr(v-1+ord("a")) for v in S))
0