結果

問題 No.2868 Another String of yuusaan
ユーザー tottoripaper
提出日時 2024-09-02 21:17:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 706 bytes
コンパイル時間 1,889 ms
コンパイル使用メモリ 192,364 KB
最終ジャッジ日時 2025-02-24 03:45:36
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using ll = std::int64_t;

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    ll N, K;
    std::cin >> N >> K;

    ll root = 1ll + std::max<ll>(N - 60, 0);
    ll n = std::min<ll>(N, 60);
    for(int i=n-1;i>=1;i--){
        ll x = (1ll << i) - 1 + root;
        x += (6ll << (i - 1));
        if(K > x){
            K -= x;
            root = 1;
        }else{
            root += 1;
        }
    }

    char res;
    if(K <= root){
        res = 'y';
    }else{
        K -= root;
        if(K <= 2){
            res = 'u';
        }else{
            K -= 3;
            res = "saan"[K % 4];
        }
    }

    std::cout << res << std::endl;
}
0