結果
問題 |
No.3299 K-th MMA String
|
ユーザー |
|
提出日時 | 2025-10-05 14:12:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,467 ms / 2,000 ms |
コード長 | 454 bytes |
コンパイル時間 | 2,197 ms |
コンパイル使用メモリ | 207,008 KB |
実行使用メモリ | 67,612 KB |
最終ジャッジ日時 | 2025-10-05 14:12:46 |
合計ジャッジ時間 | 19,253 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>n>>k; string ans=""; while(n>20){ ans+="A"; n--; } vector<string> v; for(int S=0;S<(1<<n);S++){ string tmp=""; for(int j=0;j<n;j++){ if(1&S>>j) tmp+="A"; else tmp+="M"; } bool f=false; for(int i=0;i<n-2;i++) if(tmp.substr(i,3)=="MMA") f=true; if(f) v.push_back(tmp); } sort(v.begin(),v.end()); cout<<ans+v[k-1]<<endl; }