#include<bits/stdc++.h>
#define int long long
#define pii pair<int, int>
using namespace std;
vector<pii> a;
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n; cin >> n;
a.resize(n); int pre=0;
for(auto &p : a) {
cin >> p.first;
p.second=-p.first&p.first;
p.first/=p.second;
p.second=pre+=p.second;
}
int i=0, q; cin >> q;
while(q--) {
int x; cin >> x;
while(x>a[i].second) i++;
cout << a[i].first << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
14 ms |
3992 KB |
Output is correct |
4 |
Correct |
21 ms |
2256 KB |
Output is correct |
5 |
Correct |
35 ms |
5432 KB |
Output is correct |
6 |
Correct |
27 ms |
4092 KB |
Output is correct |
7 |
Correct |
36 ms |
5452 KB |
Output is correct |
8 |
Correct |
35 ms |
5612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 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 |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
14 ms |
3992 KB |
Output is correct |
4 |
Correct |
21 ms |
2256 KB |
Output is correct |
5 |
Correct |
35 ms |
5432 KB |
Output is correct |
6 |
Correct |
27 ms |
4092 KB |
Output is correct |
7 |
Correct |
36 ms |
5452 KB |
Output is correct |
8 |
Correct |
35 ms |
5612 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
320 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
19 ms |
2960 KB |
Output is correct |
24 |
Correct |
24 ms |
5204 KB |
Output is correct |
25 |
Correct |
54 ms |
8720 KB |
Output is correct |
26 |
Correct |
31 ms |
5580 KB |
Output is correct |
27 |
Correct |
28 ms |
5492 KB |
Output is correct |
28 |
Correct |
54 ms |
9212 KB |
Output is correct |
29 |
Correct |
51 ms |
8696 KB |
Output is correct |
30 |
Correct |
31 ms |
3704 KB |
Output is correct |
31 |
Correct |
53 ms |
9068 KB |
Output is correct |