#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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
13 ms |
3412 KB |
Output is correct |
4 |
Correct |
21 ms |
1364 KB |
Output is correct |
5 |
Correct |
35 ms |
3848 KB |
Output is correct |
6 |
Correct |
20 ms |
3092 KB |
Output is correct |
7 |
Correct |
41 ms |
3772 KB |
Output is correct |
8 |
Correct |
38 ms |
3776 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 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 |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 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 |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
13 ms |
3412 KB |
Output is correct |
4 |
Correct |
21 ms |
1364 KB |
Output is correct |
5 |
Correct |
35 ms |
3848 KB |
Output is correct |
6 |
Correct |
20 ms |
3092 KB |
Output is correct |
7 |
Correct |
41 ms |
3772 KB |
Output is correct |
8 |
Correct |
38 ms |
3776 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 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 |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
20 ms |
1996 KB |
Output is correct |
24 |
Correct |
23 ms |
3312 KB |
Output is correct |
25 |
Correct |
46 ms |
5288 KB |
Output is correct |
26 |
Correct |
29 ms |
2900 KB |
Output is correct |
27 |
Correct |
27 ms |
3028 KB |
Output is correct |
28 |
Correct |
51 ms |
4548 KB |
Output is correct |
29 |
Correct |
48 ms |
3792 KB |
Output is correct |
30 |
Correct |
28 ms |
1384 KB |
Output is correct |
31 |
Correct |
60 ms |
4232 KB |
Output is correct |