답안 #937824

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
937824 2024-03-04T14:49:20 Z vjudge1 Intercastellar (JOI22_ho_t1) C++17
100 / 100
63 ms 8548 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int N; cin >> N;
	vector<int> A(N);
	for(auto &i : A) cin >> i;
	vector<long long> prefix(N, 0);
	for(int i = 0; i < N; i++){
		long long cnt = 1;
		while(A[i] % 2 == 0){
			cnt *= 2;
			A[i] /= 2;
		}
		if(i == 0) prefix[i] = cnt;
		else prefix[i] = prefix[i-1] + cnt;
	}
	int Q; cin >> Q;
	while(Q--){
		long long ind; cin >> ind;
		int lo = 0;
		int hi = N - 1;
		int bst = 0;
		while(lo <= hi){
			int mid = (lo + hi) / 2;
			if(prefix[mid] >= ind){
				bst = mid;
				hi = mid - 1;
			}else lo = mid + 1;
		}
		cout << A[bst] << "\n";
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 16 ms 3384 KB Output is correct
4 Correct 25 ms 2132 KB Output is correct
5 Correct 41 ms 4716 KB Output is correct
6 Correct 24 ms 3420 KB Output is correct
7 Correct 42 ms 4700 KB Output is correct
8 Correct 41 ms 4820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 452 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 840 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 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 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 16 ms 3384 KB Output is correct
4 Correct 25 ms 2132 KB Output is correct
5 Correct 41 ms 4716 KB Output is correct
6 Correct 24 ms 3420 KB Output is correct
7 Correct 42 ms 4700 KB Output is correct
8 Correct 41 ms 4820 KB Output is correct
9 Correct 0 ms 452 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 840 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 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 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 25 ms 2896 KB Output is correct
24 Correct 30 ms 4688 KB Output is correct
25 Correct 54 ms 8060 KB Output is correct
26 Correct 35 ms 5024 KB Output is correct
27 Correct 33 ms 5092 KB Output is correct
28 Correct 63 ms 8548 KB Output is correct
29 Correct 59 ms 8016 KB Output is correct
30 Correct 33 ms 3668 KB Output is correct
31 Correct 61 ms 8272 KB Output is correct