#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)cin>>a[i];
int q,x;
cin>>q;
int ei,ind=0;
int num=a[ind++],cnt=0;
while(num%2==0){num>>=1;cnt++;}
ei=(1<<cnt);
for(int i=0;i<q;i++){
cin>>x;
while(x>ei){
cnt=0;
num=a[ind++];
while(num%2==0){num>>=1;cnt++;}
ei+=(1<<cnt);
}
cout<<num<<endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
412 KB |
Output is correct |
3 |
Correct |
12 ms |
1884 KB |
Output is correct |
4 |
Correct |
17 ms |
1884 KB |
Output is correct |
5 |
Correct |
28 ms |
3152 KB |
Output is correct |
6 |
Correct |
18 ms |
2140 KB |
Output is correct |
7 |
Correct |
31 ms |
3228 KB |
Output is correct |
8 |
Correct |
30 ms |
3392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Execution timed out |
2097 ms |
348 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
412 KB |
Output is correct |
3 |
Correct |
12 ms |
1884 KB |
Output is correct |
4 |
Correct |
17 ms |
1884 KB |
Output is correct |
5 |
Correct |
28 ms |
3152 KB |
Output is correct |
6 |
Correct |
18 ms |
2140 KB |
Output is correct |
7 |
Correct |
31 ms |
3228 KB |
Output is correct |
8 |
Correct |
30 ms |
3392 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Execution timed out |
2097 ms |
348 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |