답안 #1119077

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1119077 2024-11-26T15:30:56 Z Icelast Intercastellar (JOI22_ho_t1) C++17
100 / 100
77 ms 10928 KB
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll maxn = 2*1e5+5, INF = 4e18+9;
void solve(){
    int n;
    cin >> n;
    vector<ll> a(n+1), cnt(n+1, 1), pf(n+2, 0);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        while(a[i]%2 == 0){
            cnt[i]*=2;
            a[i]/=2;
        }
    }
    for(int i = 1; i <= n; i++){
        pf[i] = pf[i-1]+cnt[i];
    }
    pf[n+1] = INF;
    int q;
    cin >> q;
    for(int i = 1; i <= q; i++){
        ll x;
        cin >> x;
        int p = lower_bound(pf.begin()+1, pf.end(), x) - pf.begin();
        cout << a[p] << "\n";
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 20 ms 5460 KB Output is correct
4 Correct 20 ms 2644 KB Output is correct
5 Correct 43 ms 7188 KB Output is correct
6 Correct 32 ms 5476 KB Output is correct
7 Correct 43 ms 7244 KB Output is correct
8 Correct 36 ms 7244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 476 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 552 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 20 ms 5460 KB Output is correct
4 Correct 20 ms 2644 KB Output is correct
5 Correct 43 ms 7188 KB Output is correct
6 Correct 32 ms 5476 KB Output is correct
7 Correct 43 ms 7244 KB Output is correct
8 Correct 36 ms 7244 KB Output is correct
9 Correct 2 ms 476 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 552 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 2 ms 596 KB Output is correct
23 Correct 20 ms 3548 KB Output is correct
24 Correct 33 ms 6452 KB Output is correct
25 Correct 63 ms 10508 KB Output is correct
26 Correct 44 ms 6500 KB Output is correct
27 Correct 43 ms 6796 KB Output is correct
28 Correct 77 ms 10928 KB Output is correct
29 Correct 72 ms 10316 KB Output is correct
30 Correct 38 ms 3924 KB Output is correct
31 Correct 64 ms 10748 KB Output is correct