結果

問題 No.3290 Encrypt Failed, but Decrypt Succeeded
ユーザー moon17
提出日時 2025-10-03 22:55:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
MLE  
実行時間 -
コード長 384 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 817,524 KB
最終ジャッジ日時 2025-10-03 22:55:40
合計ジャッジ時間 3,395 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 MLE * 1 -- * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
t=[*map(int,input())]
d=[0]*(1+n)
d[n]=1
for i in range(n)[::-1]:
  if t[i]==0:
    continue
  if i+1>=n or t[i+1]:
    d[i]+=d[i+1]
  if i+1<n and 10<=t[i]*10+t[i+1]<=26:
    d[i]+=d[i+2]
i=0
ans=[]
a=ord('a')
while i<n:
  if k<=d[i+1]:
    ans+=chr(t[i]+a-1),
    i+=1
  else:
    ans+=chr(t[i]*10+t[i+1]+a-1),
    k-=d[i+1]
    i+=2
print(''.join(ans))
0