Submission #526417

# Submission time Handle Problem Language Result Execution time Memory
526417 2022-02-14T17:54:16 Z benson1029 Intercastellar (JOI22_ho_t1) C++14
100 / 100
329 ms 4532 KB
#include<bits/stdc++.h>
using namespace std;

int n;
int a[200005]; long long psum[200005];
int q; long long x;

int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=1; i<=n; i++) cin >> a[i];
	for(int i=1; i<=n; i++) {
		psum[i] = psum[i-1];
		int tmp = a[i];
		while(a[i]%2==0) {
			a[i]/=2;
		}
		psum[i] += tmp/a[i];
	}
	cin >> q;
	while(q--) {
		cin >> x;
		int tmp = lower_bound(psum+1, psum+n+1, x)-psum;
		cout << a[tmp] << "\n"; 
	} 
} 
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 64 ms 2628 KB Output is correct
4 Correct 220 ms 1056 KB Output is correct
5 Correct 281 ms 2916 KB Output is correct
6 Correct 144 ms 2548 KB Output is correct
7 Correct 277 ms 2980 KB Output is correct
8 Correct 278 ms 2944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 216 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 64 ms 2628 KB Output is correct
4 Correct 220 ms 1056 KB Output is correct
5 Correct 281 ms 2916 KB Output is correct
6 Correct 144 ms 2548 KB Output is correct
7 Correct 277 ms 2980 KB Output is correct
8 Correct 278 ms 2944 KB Output is correct
9 Correct 1 ms 216 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 2 ms 332 KB Output is correct
20 Correct 2 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 2 ms 332 KB Output is correct
23 Correct 164 ms 1796 KB Output is correct
24 Correct 135 ms 2628 KB Output is correct
25 Correct 300 ms 4532 KB Output is correct
26 Correct 185 ms 2500 KB Output is correct
27 Correct 138 ms 2424 KB Output is correct
28 Correct 329 ms 3780 KB Output is correct
29 Correct 305 ms 3176 KB Output is correct
30 Correct 225 ms 1256 KB Output is correct
31 Correct 302 ms 3608 KB Output is correct