結果
| 問題 |
No.2868 Another String of yuusaan
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-31 00:02:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 1,177 bytes |
| コンパイル時間 | 4,110 ms |
| コンパイル使用メモリ | 251,588 KB |
| 最終ジャッジ日時 | 2025-02-24 03:26:40 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}