結果
問題 |
No.2766 Delicious Multiply Spice
|
ユーザー |
|
提出日時 | 2024-06-01 11:33:56 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 818 bytes |
コンパイル時間 | 4,592 ms |
コンパイル使用メモリ | 268,008 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-21 17:49:22 |
合計ジャッジ時間 | 6,294 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 8 |
other | AC * 19 RE * 12 |
ソースコード
#pragma GCC optimize "O3,omit-frame-pointer,inline" #pragma GCC push_options #pragma GCC optimize ("unroll-loops") #define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; signed main () { std::ios::sync_with_stdio(false); std::cin.tie(0); long long n; cin >> n; string ans; function<bool(long long)> dfs = [&](long long x) { if (x == 1) return true; cerr << "x = " << x << endl; x--; cerr << "x after decrement = " << x << endl; if (x % 2 == 0) { if (dfs(x / 2)) { ans += 'A'; return true; } } if (x % 3 == 0) { if (dfs(x / 3)) { ans += 'B'; return true; } } if ((x % 2 != 0) && (x % 3 != 0)) { return false; } assert(false); }; dfs(n); cout << ans << endl; return 0; }