-
Notifications
You must be signed in to change notification settings - Fork 7
/
Map
74 lines (66 loc) · 1.42 KB
/
Map
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define MAX 200010
#define MOD 1000000007
#define INF 1e15
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 3.14159265358979323846
#define endl "\n"
#define coutflg if(flg){cout << "YES\n";}else{cout << "NO\n";}
#define coutyes cout << "YES\n";
#define coutno cout << "NO\n";
#define flush fflush(stdout);
#define fixedprec cout << fixed << setprecision(18);
vector<ll> ans;
void fun(ll n, ll c){
if(!n){
return;
}
else if(n==1){
ans.push_back(c);
}
else if(n==2){
ans.push_back(c);
ans.push_back(2*c);
}
else if(n==3){
ans.push_back(c);
ans.push_back(c);
ans.push_back(3*c);
}
else{
for(ll i=1;i<=((n+1)/2);i++){
ans.push_back(c);
}
fun(n/2, 2*c);
}
return;
}
void solve(){
ll n;
cin >> n;
fun(n,1);
for(ll i=0;i<ans.size();i++){
cout << ans[i] << " ";
}
cout << endl;
}
int main(){
#ifndef ONLINE_JUDGE
// for getting input from input.txt
freopen("input.txt", "r", stdin);
// for writing output to output.txt
// freopen("output.txt", "w", stdout);
#endif
fast
ll t,q;
q = 1;
// cin >> q;
for(t=1;t<=q;t++){
// cout << "Case #" << t << ": ";
solve();
}
}