Submission #1195399

#TimeUsernameProblemLanguageResultExecution timeMemory
1195399JuanJLIntercastellar (JOI22_ho_t1)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

#define fst first 
#define snd second
#define pb push_back
#define forn(i,a,b) for(int i = a; i < b; i++)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define dbg(v) cout<<"Line("<<__LINE__<<"): "<<#v<<" = "<<v<<'\n';
#define pi pair<int,int>
#define pll pair<ll,ll>
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_multiset;

vector<ll> aux;

void maketree(ll val){
	if(val%2!=0){
		aux.pb(val);		
		return;
	}
	maketree(val/2);
	maketree(val/2);
}

int main(){
	ll n; cin>>n;
	vector<ll> a(n); forn(i,0,n) cin>>a[i];
	
	
	vector<ll> na;
	
	forn(i,0,n){
		aux.clear();
		aux={};
		maketree(a[i]);
		for(auto j:aux) na.pb(j);
	}
	
	for(auto i:na) cout<<i<<" "; cout<<'\n';
	
	ll q; cin>>q;
	
	forn(i,0,q){
		ll p; cin>>p; p--;
		cout<<na[p]<<'\n';
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...