답안 #803292

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
803292 2023-08-03T04:00:22 Z luci Intercastellar (JOI22_ho_t1) C++17
25 / 100
265 ms 5408 KB
#include<bits/stdc++.h>
using namespace std;
#define ioss ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define tup tuple<int, int, int>
#define pii pair<int, int>
#define fi first
#define se second
#define pub push_back
#define pob pop_back
int n, arr[200004], q;
signed main() {
    ioss;
    cin >> n;
    vector<pii> range(n+2);
    for(int i = 1; i <= n; i++) {
        cin >> arr[i];
        int cnt = 0;
        for(int j = 0; j < 30; j++) {
            if(arr[i]%(1ll << j) == 0) cnt = (1ll << j);
            else {
                arr[i] = arr[i]/(1ll << (j-1));
                break;
            }
        }
        range[i] = {range[i-1].se+1, range[i-1].se+cnt};
    }
    cin >> q;
    for(int i = 1; i <= q; i++) {
        int x; cin >> x;
        
        int l = 1, r = n, ret = 0;
        while(l <= r) {
            int mid = (l+r)/2;
            auto [left, right] = range[mid];
            if(x >= left && x <= right) {
                ret = mid;
                break;
            }
            if(x < left) r = mid-1;
            else l = mid+1;
        }
        cout << arr[ret] << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 57 ms 4820 KB Output is correct
4 Correct 194 ms 1740 KB Output is correct
5 Correct 233 ms 5408 KB Output is correct
6 Correct 119 ms 4320 KB Output is correct
7 Correct 265 ms 5380 KB Output is correct
8 Correct 240 ms 5400 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 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 57 ms 4820 KB Output is correct
4 Correct 194 ms 1740 KB Output is correct
5 Correct 233 ms 5408 KB Output is correct
6 Correct 119 ms 4320 KB Output is correct
7 Correct 265 ms 5380 KB Output is correct
8 Correct 240 ms 5400 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 1 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -