Submission #536740

# Submission time Handle Problem Language Result Execution time Memory
536740 2022-03-14T00:56:35 Z xp875 Intercastellar (JOI22_ho_t1) C++17
25 / 100
389 ms 3228 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
	//ios_base::sync_with_stdio(0); cin.tie(0);
	
	int n, q;
	cin >> n;
	int a[n];
	for(int i=0; i<n; i++) cin >> a[i];
	
	vector<pair<int, int> > v;
	v.push_back(make_pair(0, 0));
	for(int i=0; i<n; i++) {
		int x = a[i], count = 0;
		while(x%2==0) {
			x/=2; 
			count++;
		}
		v.push_back(make_pair(v.back().first+(1<<count), x));
	}
	cin >> q;
	while(q--) {
		int x;
		cin >> x;
		int ans = upper_bound(v.begin(), v.end(), make_pair(x, 0)) - v.begin();
		cout << v[ans].second << '\n';
	}
	
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 98 ms 3200 KB Output is correct
4 Correct 255 ms 1236 KB Output is correct
5 Correct 389 ms 3160 KB Output is correct
6 Correct 181 ms 3004 KB Output is correct
7 Correct 380 ms 3228 KB Output is correct
8 Correct 351 ms 3228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 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 -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 98 ms 3200 KB Output is correct
4 Correct 255 ms 1236 KB Output is correct
5 Correct 389 ms 3160 KB Output is correct
6 Correct 181 ms 3004 KB Output is correct
7 Correct 380 ms 3228 KB Output is correct
8 Correct 351 ms 3228 KB Output is correct
9 Correct 1 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 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 3 ms 212 KB Output is correct
17 Incorrect 1 ms 212 KB Output isn't correct
18 Halted 0 ms 0 KB -