#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
#define eb emplace_back
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
const ll mxn=2e5+5;
vector<pl> vt;
int main()
{
ios::sync_with_stdio(0); cin.tie(0);
ll n; cin>>n;
for (int i=1;i<=n;i++)
{
ll a; cin>>a;
ll cnt=1;
while (a%2==0)
{
a/=2;
cnt*=2;
}
vt.eb(a,cnt);
}
ll q; cin>>q;
while (q--)
{
ll x; cin>>x;
ll c=0,pos=0;
while (c<n and pos+vt[c].ss<x)
{
pos+=vt[c].ss;
c++;
}
cout<<vt[c].ff<<'\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1932 ms |
4556 KB |
Output is correct |
4 |
Correct |
1964 ms |
1492 KB |
Output is correct |
5 |
Execution timed out |
2087 ms |
4556 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1932 ms |
4556 KB |
Output is correct |
4 |
Correct |
1964 ms |
1492 KB |
Output is correct |
5 |
Execution timed out |
2087 ms |
4556 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |