結果
| 問題 |
No.2766 Delicious Multiply Spice
|
| コンテスト | |
| ユーザー |
ripity
|
| 提出日時 | 2024-05-27 16:23:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 474 bytes |
| コンパイル時間 | 2,066 ms |
| コンパイル使用メモリ | 198,600 KB |
| 最終ジャッジ日時 | 2025-02-21 16:53:41 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 8 |
| other | AC * 23 TLE * 1 -- * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
long long N;
vector<string> ans_all;
mt19937 ra(time(NULL));
void dfs(long long x, string S) {
if(x == N) {
ans_all.push_back(S);
}else if(x < N) {
if(ra() & 1) {
dfs(2 * x + 1, S + 'A');
dfs(3 * x + 1, S + 'B');
}else {
dfs(3 * x + 1, S + 'B');
dfs(2 * x + 1, S + 'A');
}
}
}
int main() {
cin >> N;
dfs(1, "");
assert(ans_all.size() == 1);
cout << ans_all[0] << endl;
}
ripity