結果

問題 No.566 だいたい完全二分木
ユーザー 👑 CleyL
提出日時 2022-09-22 10:21:18
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 397 bytes
コンパイル時間 874 ms
コンパイル使用メモリ 72,240 KB
最終ジャッジ日時 2025-02-07 13:33:40
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
vector<int> A;
int x;
void solve(int a,int b){
    if(x != a+1)A.push_back(a+1);
    if(b!=1){
        solve(a-b/2,b/2);
        solve(a+b/2,b/2);
    }
}
int main(){
    int n;cin>>n;
    x = (1<<(n-1));
    solve((1<<(n-2)),(1<<(n-2)));
    for(int i = 0; A.size() > i; i++){
        cout << A[i] << " ";
    }
    cout << 1 << endl;
}
0