結果
| 問題 |
No.3299 K-th MMA String
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2025-10-05 14:21:08 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,961 bytes |
| コンパイル時間 | 2,734 ms |
| コンパイル使用メモリ | 279,996 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-10-05 14:21:16 |
| 合計ジャッジ時間 | 3,766 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define REP(i,n) for(int i=0; i<n; i++)
bool chmax(auto& a, auto b) { return a<b ? a=b, true : false; }
bool chmin(auto& a, auto b) { return a>b ? a=b, true : false; }
using ll=long long; const int INF=1e9+10; const ll INFL=4e18;
#ifdef DEBUG
#include "./debug.hpp"
#else
#define debug(...)
#define print_line
#endif
/// @brief ビット演算
namespace Bit{
/// @brief 1であるビットの個数を返す
int PopCount(int n) { return __builtin_popcount(n); }
/// @brief 1であるビットの個数を返す
int PopCount(ll n) { return __builtin_popcountll(n); }
/// @brief popcountの偶奇を返す
int Parity(int n) { return __builtin_parity(n); }
/// @brief popcountの偶奇を返す
int Parity(ll n) { return __builtin_parityll(n); }
/// @brief 最上位ビットの位置を返す
int TopBit(int n) { return n ? 31-__builtin_clz(n) : -1; }
/// @brief 最上位ビットの位置を返す
int TopBit(ll n) { return n ? 63-__builtin_clzll(n) : -1; }
/// @brief 2進表現の長さを返す
int BitLength(int n) { return n ? 32-__builtin_clz(n) : 1; }
//// @brief 2進表現の長さを返す
int BitLength(ll n) { return n ? 64-__builtin_clzll(n) : 1; }
/// @brief 最下位ビットの位置を返す
int LowBit(int n) { return n ? __builtin_ctz(n) : -1; }
/// @brief 最下位ビットの位置を返す
int LowBit(ll n) { return n ? __builtin_ctzll(n) : -1; }
/// @brief 2のべき乗か否かを返す
bool IsPowerOfTwo(int n) { return n && (n&-n)==n; }
/// @brief 0~n-1 ビットを立てたビットマスクを返す
ll Mask(int n) { return (1LL<<n)-1; }
/// @brief iビット目が立っているか否かを返す
bool HasBit(ll n,int i) { return (n>>i&1); }
/// @brief 整数 n の2進表現を返す
/// @param len ビット数
/// @param rev 反転するか否か
string ToBinary(ll n,int len=32,bool rev=false) {
string ret;
for(int i=0; i<len; i++) ret+=HasBit(n,rev?len-1-i:i)?'1':'0';
return ret;
}
}
//----------------------------------------------------------
void solve() {
int N,K; cin>>N>>K;
int n=min(N,20);
int cur=0;
REP(b,1<<n) {
bool ok=false;
int x=b;
while(x>0) {
if(x%8==6) ok=true;
x/=2;
}
if(ok) cur++;
if(cur==K) {
string s;
REP(i,N) {
if(b>>i&1) s.push_back('M');
else s.push_back('A');
}
reverse(ALL(s));
string pref="";
if(n<N) REP(i,N-n) pref+="A";
cout<<pref<<s<<endl;
return;
}
}
}
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
//cout<<fixed<<setprecision(15);
int T=1; //cin>>T;
while(T--) solve();
}
Today03