Submission #815158

# Submission time Handle Problem Language Result Execution time Memory
815158 2023-08-08T12:48:34 Z MohamedAhmed04 Intercastellar (JOI22_ho_t1) C++14
100 / 100
67 ms 9956 KB
#include <bits/stdc++.h>

using namespace std ;

const int MAX = 2e5 + 10 ;

int arr[MAX] ;
int n , q ;

long long cnt[MAX] , pref[MAX] ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	for(int i = 1 ; i <= n ; ++i)
		cin>>arr[i] ;
	for(int i = 1 ; i <= n ; ++i)
	{
		cnt[i] = 1 ;
		while(arr[i] % 2 == 0)
			arr[i] /= 2 , cnt[i] *= 2 ;
		pref[i] = pref[i-1] + cnt[i] ;
	}
	cin>>q ;
	while(q--)
	{
		long long x ;
		cin>>x ;
		int idx = lower_bound(pref+1 , pref+n+1 , x) - pref ;
		cout<<arr[idx]<<"\n" ;
	}
	return 0 ;
}		
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 16 ms 4724 KB Output is correct
4 Correct 25 ms 2516 KB Output is correct
5 Correct 42 ms 6312 KB Output is correct
6 Correct 29 ms 4648 KB Output is correct
7 Correct 41 ms 6348 KB Output is correct
8 Correct 44 ms 6392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 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 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 16 ms 4724 KB Output is correct
4 Correct 25 ms 2516 KB Output is correct
5 Correct 42 ms 6312 KB Output is correct
6 Correct 29 ms 4648 KB Output is correct
7 Correct 41 ms 6348 KB Output is correct
8 Correct 44 ms 6392 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 336 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 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 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 352 KB Output is correct
23 Correct 26 ms 3192 KB Output is correct
24 Correct 35 ms 5820 KB Output is correct
25 Correct 54 ms 9580 KB Output is correct
26 Correct 36 ms 6020 KB Output is correct
27 Correct 32 ms 6116 KB Output is correct
28 Correct 67 ms 9956 KB Output is correct
29 Correct 60 ms 9492 KB Output is correct
30 Correct 32 ms 3820 KB Output is correct
31 Correct 63 ms 9920 KB Output is correct