답안 #1023958

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1023958 2024-07-15T10:11:00 Z Acanikolic Intercastellar (JOI22_ho_t1) C++14
100 / 100
63 ms 10832 KB
#include <bits/stdc++.h>  

#define int long long 

#define pb push_back
 
#define F first
 
#define S second
 
using namespace std;
 
const int N = 2e5 + 10;
 
const int mod = 1e9 + 7;
 
const int inf = 1e9;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
 	int n;
 	cin >> n;
 	vector<int>a(n + 1);
 	vector<pair<int,int>>pref(n + 1);
 	for(int i = 1; i <= n; i++) {
 		cin >> a[i];
 		int pw = 1;
 		while(a[i] % (pw * 2) == 0) pw *= 2;
 		pref[i] = {a[i] / pw,pw};
 		pref[i].S += pref[i - 1].S;
 	}
 	int q;
 	cin >> q;
 	while(q--) {
 		int x;
 		cin >> x;
 		int l = 1,r = n,ans = 0;
 		while(l <= r) {
 			int mid = (l + r) / 2;
 			if(pref[mid].S <= x) {
 				ans = mid;
 				l = mid + 1;
 			}else {
 				r = mid - 1;
 			}
 		}
 		if(pref[ans].S < x) ans++;
 		cout << pref[ans].F << "\n";
 	}
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 16 ms 5688 KB Output is correct
4 Correct 23 ms 2652 KB Output is correct
5 Correct 37 ms 7248 KB Output is correct
6 Correct 27 ms 5468 KB Output is correct
7 Correct 51 ms 7184 KB Output is correct
8 Correct 42 ms 7116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 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 848 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 16 ms 5688 KB Output is correct
4 Correct 23 ms 2652 KB Output is correct
5 Correct 37 ms 7248 KB Output is correct
6 Correct 27 ms 5468 KB Output is correct
7 Correct 51 ms 7184 KB Output is correct
8 Correct 42 ms 7116 KB Output is correct
9 Correct 1 ms 348 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 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 600 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 848 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 20 ms 3264 KB Output is correct
24 Correct 26 ms 6332 KB Output is correct
25 Correct 48 ms 10320 KB Output is correct
26 Correct 33 ms 6720 KB Output is correct
27 Correct 47 ms 6736 KB Output is correct
28 Correct 59 ms 10832 KB Output is correct
29 Correct 59 ms 10268 KB Output is correct
30 Correct 27 ms 3996 KB Output is correct
31 Correct 63 ms 10776 KB Output is correct