Submission #941371

# Submission time Handle Problem Language Result Execution time Memory
941371 2024-03-08T16:05:08 Z Reverberate Intercastellar (JOI22_ho_t1) C++14
100 / 100
79 ms 11004 KB
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;

template <typename T>
using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename K, typename V>
using pbds_map = tree<K, V, less<K>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define double long double
#define INF 1e18
#define DEBUG 0


signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	vector<pair<int,int>>vect(n);
	for(int i=0;i<n;i++){
		int a,sz=1;
		cin>>a;
		while(a%2==0){
			a/=2;
			sz*=2;
		}
		vect[i]={a,sz};
	}
	vector<int>tmp;
	tmp.push_back(0);
	for(int i=0;i<n;i++){
		tmp.push_back(vect[i].second+tmp.back());
	}
	int q;
	cin>>q;
	while(q--){
		int t;
		cin>>t;
		auto it = (lower_bound(tmp.begin(),tmp.end(),t) - tmp.begin());
		cout<<vect[--it].first<<'\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 16 ms 7252 KB Output is correct
4 Correct 23 ms 2780 KB Output is correct
5 Correct 40 ms 7368 KB Output is correct
6 Correct 23 ms 5592 KB Output is correct
7 Correct 39 ms 7368 KB Output is correct
8 Correct 40 ms 7376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 452 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 456 KB Output is correct
11 Correct 1 ms 520 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 16 ms 7252 KB Output is correct
4 Correct 23 ms 2780 KB Output is correct
5 Correct 40 ms 7368 KB Output is correct
6 Correct 23 ms 5592 KB Output is correct
7 Correct 39 ms 7368 KB Output is correct
8 Correct 40 ms 7376 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 600 KB Output is correct
13 Correct 0 ms 452 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 456 KB Output is correct
19 Correct 1 ms 520 KB Output is correct
20 Correct 1 ms 600 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 464 KB Output is correct
23 Correct 24 ms 3552 KB Output is correct
24 Correct 28 ms 6616 KB Output is correct
25 Correct 55 ms 10444 KB Output is correct
26 Correct 34 ms 6864 KB Output is correct
27 Correct 33 ms 6940 KB Output is correct
28 Correct 79 ms 10972 KB Output is correct
29 Correct 58 ms 10372 KB Output is correct
30 Correct 29 ms 4064 KB Output is correct
31 Correct 61 ms 11004 KB Output is correct