結果

問題 No.566 だいたい完全二分木
ユーザー latte0119latte0119
提出日時 2017-09-08 23:03:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 706 bytes
コンパイル時間 1,858 ms
コンパイル使用メモリ 160,224 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 20:55:36
合計ジャッジ時間 3,806 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int K;

vint ans;
void dfs(int l,int r){
    if(l==r)return;
    int m=(l+r)/2;
    ans.pb(m);
    dfs(l,m);
    dfs(m+1,r);
}
signed main(){
    cin>>K;
    dfs(0,(1<<K)-1);
    rep(i,ans.size()){
        if(i)cout<<" ";
        cout<<ans[i]+1;
    }cout<<endl;
    return 0;
}
0