# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
938604 | 2024-03-05T11:02:35 Z | vjudge1 | Intercastellar (JOI22_ho_t1) | C++17 | 48 ms | 3156 KB |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; vector<int> sums(n); for (int i = 0; i < n; i++) { int temp = v[i]; int cnt = 0; while (temp%2==0) { temp/=2; cnt++; } sums[i] = cnt; } vector<int> pref_sum(n,0); pref_sum[0] = (1<<sums[0]); for (int i = 1; i < n; i++) pref_sum[i] = pref_sum[i-1]+(1<<sums[i]); int q; cin >> q; while(q--) { int x; cin >> x; int l = 0, r = n-1; while (r-l>1) { int mid = l+r>>1; if (pref_sum[mid] <= x) l = mid; else r = mid; } if (pref_sum[l] >= x) cout << v[l]/(1<<(sums[l])) << '\n'; else cout << v[r]/(1<<(sums[r])) << '\n'; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 17 ms | 2760 KB | Output is correct |
4 | Correct | 39 ms | 1420 KB | Output is correct |
5 | Correct | 47 ms | 3152 KB | Output is correct |
6 | Correct | 27 ms | 2392 KB | Output is correct |
7 | Correct | 48 ms | 3156 KB | Output is correct |
8 | Correct | 47 ms | 3136 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 0 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 | Incorrect | 0 ms | 348 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 17 ms | 2760 KB | Output is correct |
4 | Correct | 39 ms | 1420 KB | Output is correct |
5 | Correct | 47 ms | 3152 KB | Output is correct |
6 | Correct | 27 ms | 2392 KB | Output is correct |
7 | Correct | 48 ms | 3156 KB | Output is correct |
8 | Correct | 47 ms | 3136 KB | Output is correct |
9 | Correct | 1 ms | 600 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 344 KB | Output is correct |
14 | Correct | 0 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 | Incorrect | 0 ms | 348 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |