답안 #544810

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
544810 2022-04-02T18:41:39 Z blue Intercastellar (JOI22_ho_t1) C++17
100 / 100
114 ms 9164 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;

using pii = pair<int, int>;
using vpii = vector<pii>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define sz(x) int(x.size())

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

	int N;
	cin >> N;

	vll A(1+N), C(1+N, 1);
	for(int i = 1; i <= N; i++)
	{
		cin >> A[i];
		while(A[i] % 2 == 0)
		{
			A[i] /= 2;
			C[i] *= 2;
		}
	}

	C[0] = 0;
	for(int i = 1; i <= N; i++) C[i] += C[i-1];


	int Q;
	cin >> Q;

	for(int j = 1; j <= Q; j++)
	{
		ll X;
		cin >> X;

		int lo = 1, hi = N;
		while(lo != hi)
		{
			int mid = (lo+hi)/2;
			if(C[mid] >= X)
				hi = mid;
			else
				lo = mid+1;
		}

		cout << A[lo] << '\n';
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 21 ms 3968 KB Output is correct
4 Correct 31 ms 2352 KB Output is correct
5 Correct 56 ms 5560 KB Output is correct
6 Correct 32 ms 3976 KB Output is correct
7 Correct 55 ms 5580 KB Output is correct
8 Correct 59 ms 5592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 21 ms 3968 KB Output is correct
4 Correct 31 ms 2352 KB Output is correct
5 Correct 56 ms 5560 KB Output is correct
6 Correct 32 ms 3976 KB Output is correct
7 Correct 55 ms 5580 KB Output is correct
8 Correct 59 ms 5592 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 292 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 41 ms 3040 KB Output is correct
24 Correct 35 ms 5192 KB Output is correct
25 Correct 73 ms 8808 KB Output is correct
26 Correct 59 ms 5516 KB Output is correct
27 Correct 54 ms 5496 KB Output is correct
28 Correct 97 ms 9164 KB Output is correct
29 Correct 114 ms 8684 KB Output is correct
30 Correct 44 ms 3700 KB Output is correct
31 Correct 105 ms 9164 KB Output is correct