結果

問題 No.2868 Another String of yuusaan
ユーザー ShirotsumeShirotsume
提出日時 2024-08-30 22:50:17
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,030 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 68,780 KB
最終ジャッジ日時 2024-08-30 22:50:19
合計ジャッジ時間 2,463 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
56,180 KB
testcase_01 AC 42 ms
55,564 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 44 ms
56,944 KB
testcase_18 AC 43 ms
56,616 KB
testcase_19 AC 45 ms
56,236 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 = [4]
L = [7]
for i in range(min(n, 40)):
    cnt.append(cnt[-1] * 4)
    L.append(L[-1] + 6 * cnt[-2])


def solve(n, k):
    if n == 0:
        return S[k]
    else:
        mid = 'uusaa'
        if k == 0:
            return 'y'
        k -= 1
        if k < L[n - 1]:
            return solve(n - 1, k)
        k -= L[n - 1]
        if k < L[n - 1]:
            return solve(n - 1, k)
        k -= L[n - 1]
        if k == 0:
            return 's'
        k -= 1
        if k < L[n - 1]:
            return solve(n - 1, k)
        k -= L[n - 1]
        if k < L[n - 1]:
            return solve(n - 1, k)
        k -= L[n - 1]
        return 'n'
    
print(solve(n, k))
0