結果
| 問題 |
No.2766 Delicious Multiply Spice
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-08 15:40:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 858 bytes |
| コンパイル時間 | 2,356 ms |
| コンパイル使用メモリ | 169,304 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-12-28 02:20:09 |
| 合計ジャッジ時間 | 35,317 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 8 |
| other | AC * 20 WA * 3 TLE * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)n; i++)
using ll = long long int;
int main() {
ll N;
cin >> N;
auto dfs = [&](auto dfs, ll x, string S) {
if (x == N) {
rep(i, (int)S.size())
cout << S[i];
cout << endl;
return true;
}
if (x == (N-1) / 2) {
rep(i, (int)S.size())
cout << S[i];
cout << 'A' << endl;
return true;
}
if (x == (N-1) / 3) {
rep(i, (int)S.size())
cout << S[i];
cout << 'B' << endl;
return true;
}
if (x > N)
return false;
bool ret = false;
ret = (dfs(dfs, x * 4 + 3, S + "AA")) || ret;
ret = (dfs(dfs, x * 6 + 3, S + "BA")) || ret;
ret = (dfs(dfs, x * 6 + 4, S + "AB")) || ret;
ret = (dfs(dfs, x * 9 + 4, S + "BB")) || ret;
return ret;
};
dfs(dfs, 1, "");
return 0;
}