結果
| 問題 | No.2868 Another String of yuusaan |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-31 00:02:15 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 1,177 bytes |
| 記録 | |
| コンパイル時間 | 2,662 ms |
| コンパイル使用メモリ | 277,648 KB |
| 実行使用メモリ | 16,384 KB |
| 最終ジャッジ日時 | 2026-07-05 14:07:48 |
| 合計ジャッジ時間 | 3,964 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
template<typename T>
bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; }
template<typename T>
bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; }
struct io_setup {
io_setup() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout << fixed << setprecision(15);
}
} io_setup;
using mint=atcoder::modint998244353;
int main(){
ll n,k;
cin>>n>>k;
string s="yuusaan";
k--;
if(n>k){
cout<<"y\n";
return 0;
}
if(n>26){
int x=-1;
rep(i,1,27){
ll tmp=(1LL<<(i*2))*2-1+n-i;
if(tmp>k){
x=i;
break;
}
}
k-=(n-x);
n=x;
}
while(n>1){
ll tmp=(1LL<<((n-1)*2))*2-1;
if(k==0){
cout<<"y\n";
return 0;
}
k--;
if(k<tmp){
n--;
continue;
}else k-=tmp;
if(k<tmp){
n--;
continue;
}else k-=tmp;
if(k==0){
cout<<"s\n";
return 0;
}
k--;
if(k<tmp){
n--;
continue;
}else k-=tmp;
if(k<tmp){
n--;
continue;
}else k-=tmp;
if(k==0){
cout<<"n\n";
return 0;
}
k--;
assert(0);
}
cout<<s.at(k)<<endl;
}