This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bitset>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <system_error>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#define pb push_back
#define MOD 1000000007
#define NMAX 200001
#define MAX 1000000000
#define nl '\n'
#define pii1 pair<int, pair<int,int>> (1,(1,2));
#define pii pair<int,int>
#define tpl tuple<int,int,int>
#define int long long
using namespace std;
ifstream fin("data.in");
ofstream fout("data.out");
const int INF=1e12;
/*
====================DEMONSTRATION======================
=========================END===========================
*/
int n;
vector<int>v;
int q;
map<int,int>mp;
void prec()
{
for(int i=1;i<=MAX;++i)
mp[i]=1;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// prec();
cin>>n;
v.resize(n+1);
for(int i=1;i<=n;++i)
{
cin>>v[i];
}
vector<int>ans;
for(int i=1;i<=n;++i)
{
if(v[i]%2==0)
{
int aux=v[i]/2;
while(aux%2==0)
aux/=2;
int cnt=v[i]/aux;
while(cnt--)
ans.pb(aux);
}
else
ans.pb(v[i]);
}
cin>>q;
for(int i=1;i<=q;++i)
{
int x;
cin>>x;
cout<<ans[x-1]<<nl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |