#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin >> N;
vector<long long> value(N);
vector<long long> len(N, 1);
for (int i = 0; i < N; i++)
{
cin >> value[i];
while (value[i] % 2 == 0)
{
value[i] /= 2;
len[i] *= 2;
}
}
for (int i = 1; i < N; i++)
{
len[i] += len[i - 1];
}
int Q;
cin >> Q;
for (int i = 0; i < Q; i++)
{
int x;
cin >> x;
int j = 0;
while (x > len[j])
{
j++;
}
cout << value[j] << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1259 ms |
3356 KB |
Output is correct |
4 |
Correct |
1373 ms |
1372 KB |
Output is correct |
5 |
Execution timed out |
2064 ms |
3632 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
3 ms |
212 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1259 ms |
3356 KB |
Output is correct |
4 |
Correct |
1373 ms |
1372 KB |
Output is correct |
5 |
Execution timed out |
2064 ms |
3632 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |