結果

問題 No.2868 Another String of yuusaan
ユーザー t98slidert98slider
提出日時 2024-09-01 21:24:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 645 bytes
コンパイル時間 2,117 ms
コンパイル使用メモリ 205,372 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-01 21:24:38
合計ジャッジ時間 3,213 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,940 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
6,940 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, k;
	cin >> n >> k;
	if(k <= n){
		cout << "y\n";
		return 0;
	}
	string s = "yuusaan";
	vector<ll> dp(1);
	dp[0] = 7;
	while(dp.back() <= 10'000'000'000'000'000ll){
		dp.push_back(dp.back() * 4 + 3);
	}
	ll d = max(0ll, n - (ll)dp.size());
	n -= d + 1;
	k -= d + 1;
	for(int i = n; i >= 1; i--){
		if(k == 0){
			cout << "y\n";
			exit(0);
		}
		if(k == 2 * dp[i - 1]){
			cout << "s\n";
			return 0;
		}
		if(k == dp[i] - 1){
			cout << "n\n";
			return 0;
		}
		k--;
		k %= dp[i - 1];
	}
	cout << s[k] << '\n';
}
0