結果
| 問題 |
No.2766 Delicious Multiply Spice
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-28 09:51:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,080 bytes |
| コンパイル時間 | 1,762 ms |
| コンパイル使用メモリ | 168,388 KB |
| 実行使用メモリ | 1,380,956 KB |
| 最終ジャッジ日時 | 2024-12-20 22:04:07 |
| 合計ジャッジ時間 | 24,478 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 8 |
| other | AC * 20 TLE * 3 MLE * 8 |
ソースコード
#include <bits/stdc++.h>
#include <chrono>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rrep(i,a,b) for(int i = a; i < b; i++)
#define all(A) (A).begin(),(A).end()
#define MOD 1000000007
#define grt greater<int>()
#define mapf(M) for(auto& [k,v] : M)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using pq = priority_queue<ll,vector<ll>,greater<ll>>;
ll INF = 1LL<<60;
template <typename T>
bool chmax(T &a,T &b){ if(a < b){ a = b; return true; } return false; }
template <typename T>
bool chmin(T &a,T &b){ if(a > b){ a = b; return true; } return false; }
struct Edge { int to; int cost; int from; };
using Graph = vector<vector<Edge>>;
using vi = vector<int>;
void dfs(string s,string& ans,int x,int n){
if(n == x) return;
if(x*2+1 <= n){
s.push_back('A');
dfs(s,ans,x*2+1,n);
if(x*2+1 == n) ans = s;
s.pop_back();
}
if(x*3+1 <= n){
s.push_back('B');
dfs(s,ans,x*3+1,n);
if(x*3+1 == n) ans = s;
s.pop_back();
}
return;
}
int main(void){
int n; cin >> n;
string ans = "",s = "";
int x = 1;
dfs(s,ans,x,n);
cout << ans;
}