답안 #656934

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
656934 2022-11-08T14:15:36 Z Darren0724 Intercastellar (JOI22_ho_t1) C++17
100 / 100
80 ms 10748 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()


void solve(){
    int n;cin>>n;
    vector<int> a(n),b(n);
    for(int i=0;i<n;i++){
        int k;cin>>k;
        int p=1;
        while(k%2==0){
            k/=2;
            p*=2;
        }
        a[i]=k;
        b[i]=p;
    }
    vector<int> v(n+1);
    for(int i=1;i<=n;i++){
        v[i]=v[i-1]+b[i-1];
    }
    int q;cin>>q;
    for(int i=0;i<q;i++){
        int k;cin>>k;
        int r=lower_bound(all(v),k)-v.begin();
        cout<<a[r-1]<<'\n';
    }
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    while(t--){
        solve();
    }


    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 21 ms 5528 KB Output is correct
4 Correct 29 ms 2676 KB Output is correct
5 Correct 55 ms 7024 KB Output is correct
6 Correct 33 ms 5396 KB Output is correct
7 Correct 53 ms 7092 KB Output is correct
8 Correct 51 ms 7152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 272 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 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 340 KB Output is correct
12 Correct 1 ms 328 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 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 21 ms 5528 KB Output is correct
4 Correct 29 ms 2676 KB Output is correct
5 Correct 55 ms 7024 KB Output is correct
6 Correct 33 ms 5396 KB Output is correct
7 Correct 53 ms 7092 KB Output is correct
8 Correct 51 ms 7152 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 272 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 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 328 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 28 ms 3312 KB Output is correct
24 Correct 33 ms 6352 KB Output is correct
25 Correct 68 ms 10364 KB Output is correct
26 Correct 44 ms 6480 KB Output is correct
27 Correct 52 ms 6644 KB Output is correct
28 Correct 80 ms 10736 KB Output is correct
29 Correct 73 ms 10216 KB Output is correct
30 Correct 39 ms 3896 KB Output is correct
31 Correct 74 ms 10748 KB Output is correct