結果
問題 | No.2868 Another String of yuusaan |
ユーザー |
|
提出日時 | 2024-09-01 21:24:34 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.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 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 WA * 7 |
ソースコード
#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'; }