結果

問題 No.2864 String of yuusaan
ユーザー ShirotsumeShirotsume
提出日時 2024-08-30 21:39:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 817 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 57,168 KB
最終ジャッジ日時 2024-08-30 21:39:54
合計ジャッジ時間 1,797 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
57,168 KB
testcase_01 AC 42 ms
55,636 KB
testcase_02 AC 45 ms
55,744 KB
testcase_03 AC 43 ms
56,136 KB
testcase_04 AC 43 ms
56,504 KB
testcase_05 AC 44 ms
55,896 KB
testcase_06 AC 43 ms
55,904 KB
testcase_07 AC 44 ms
56,312 KB
testcase_08 AC 43 ms
55,888 KB
testcase_09 AC 43 ms
55,328 KB
testcase_10 AC 44 ms
55,596 KB
testcase_11 AC 44 ms
56,904 KB
testcase_12 AC 43 ms
55,856 KB
testcase_13 AC 44 ms
56,928 KB
testcase_14 AC 45 ms
55,532 KB
testcase_15 AC 43 ms
56,176 KB
testcase_16 AC 43 ms
56,200 KB
testcase_17 AC 44 ms
56,908 KB
testcase_18 AC 42 ms
55,764 KB
testcase_19 AC 42 ms
55,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
def debug(*x):print('debug:',*x, file=sys.stderr)
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 61 - 1
mod = 998244353

n, k = mi()
n -= 1
k -= 1
S = 'yuusaan'
n = min(n, 60)
cnt = [2]
L = [7]
for i in range(min(n, 60)):
    cnt.append(cnt[-1] * 2)
    L.append(L[-1] + 6 * cnt[-2])

def solve(n, k):
    if n == 0:
        return S[k]
    else:
        mid = 'uusaa'
        if n >= 60:
            return solve(n - 1, k)
        if k >= L[n - 1] + 5:
            return solve(n - 1, k - L[n - 1] - 5)
        elif k >= L[n - 1]:
            return mid[k - L[n - 1]]
        else:
            return solve(n - 1, k)
    
print(solve(n, k))
0