結果

問題 No.566 だいたい完全二分木
ユーザー HIR180HIR180
提出日時 2017-09-08 22:44:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 986 bytes
コンパイル時間 1,888 ms
コンパイル使用メモリ 161,896 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 20:41:43
合計ジャッジ時間 2,189 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 7 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<int>ans[15];
int main(){
	ans[2].pb(3); ans[2].pb(1); ans[2].pb(2);
	for(int i=3;i<=12;i++){
		ans[i] = ans[i-1];
		reverse(ans[i].begin(),ans[i].end());
		ans[i].pb(1<<(i-1));
		reverse(ans[i].begin(),ans[i].end());
		for(int ii=0;ii<ans[i-1].size();ii++){
			ans[i].pb(ans[i-1][ii]+(1<<(i-1)));
		}
	}
	int k;cin>>k;
	for(int ii=0;ii<ans[k].size();ii++)cout<<ans[k][ii]<<endl;
}
0