結果
| 問題 |
No.3299 K-th MMA String
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-05 16:07:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 1,036 bytes |
| コンパイル時間 | 798 ms |
| コンパイル使用メモリ | 99,540 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-10-05 16:07:39 |
| 合計ジャッジ時間 | 1,672 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> Pii;
const ll mod = 998244353;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, k;
cin >> n >> k;
int found_num = 0;
for (int i = 0; i < (1 << 24); i++) {
bool contains_mma = false;
for (int j = 24; j >= 2; j--) {
if (((i >> j) & 1) == 1 && ((i >> (j - 1)) & 1) == 1 && ((i >> (j - 2)) & 1) == 0) {
contains_mma = true;
break;
}
}
if (contains_mma) {
found_num++;
if (found_num == k) {
string ans = "";
for (int j = n - 1; j >= 0; j--) {
if (j > 24) ans.push_back('A');
else if (((i >> j) & 1) == 1) ans.push_back('M');
else ans.push_back('A');
}
cout << ans << endl;
return 0;
}
}
}
return 0;
}