結果

問題 No.566 だいたい完全二分木
コンテスト
ユーザー CleyL
提出日時 2022-09-22 10:21:18
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 397 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 421 ms
コンパイル使用メモリ 89,600 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-27 17:01:56
合計ジャッジ時間 2,340 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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