結果

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

ソースコード

diff #

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

q=[0]*n+[1]
for i in reversed(range(n)):
  c=0
  if i+1<=n and 1<=int(T[i:i+1])<=26 and T[i]!="0":
    c+=q[i+1]
  if i+2<=n and 1<=int(T[i:i+2])<=26 and T[i]!="0":
    c+=q[i+2]
  q[i]=c
  q[i]=min(q[i],10**18)

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

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