結果
| 問題 |
No.3299 K-th MMA String
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-05 14:10:51 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 616 bytes |
| コンパイル時間 | 2,844 ms |
| コンパイル使用メモリ | 279,180 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-10-05 14:10:57 |
| 合計ジャッジ時間 | 3,943 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,K;
cin>>N>>K;
if(N>20){
cout<<string(N-20,'A');
}
N=min(N,20);
for(ll bit=0;bit<(1<<N);bit++){
string T="";
bool OK=0;
for(int n=0;n<N;n++){
if(bit&(1<<(N-1-n)))T.push_back('M');
else T.push_back('A');
if(n>1&&T.substr(n-2,3)=="MMA")OK=1;
}
if(OK){
K--;
}
if(K==0){
cout<<T<<"\n";
return 0;
}
}
}