답안 #534070

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
534070 2022-03-08T00:16:47 Z Cookie197 Intercastellar (JOI22_ho_t1) C++14
100 / 100
76 ms 8632 KB
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define ll long long
#define pii pair<ll,ll> 
#define mp make_pair
#define endl "\n"
#define out(x) cout << #x << " = " << x << endl
#define outp(x) cout << #x << ".first = " << x.first << "  " << #x << ".second = " << x.second << endl
#pragma GCC optimize("Ofast")

int n,q;
ll arr[200005];
pii res[200005];
vector<ll> pre;
signed main(){
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>n;
    pre.push_back(0);
    for (int i=1;i<=n;i++) {
        cin>>arr[i];
        ll cnt=1, r=arr[i];
        while(1){
            if (r%2==1) break;
            r/=2; cnt*=2;
        }
        res[i] = mp(cnt, r);
        pre.push_back(pre.back()+cnt);
    }

    //for (int i=1;i<=n;i++) outp(res[i]), cout<<pre[i]<<endl;

    cin>>q;
    while(q--){
        ll x; cin>>x;
        int pos = lower_bound(pre.begin(),pre.end(),x) - pre.begin();
        //cout<<"#";
        cout<<res[pos].second<<endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 21 ms 6540 KB Output is correct
4 Correct 28 ms 2216 KB Output is correct
5 Correct 51 ms 7016 KB Output is correct
6 Correct 29 ms 5876 KB Output is correct
7 Correct 54 ms 7096 KB Output is correct
8 Correct 50 ms 7036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 21 ms 6540 KB Output is correct
4 Correct 28 ms 2216 KB Output is correct
5 Correct 51 ms 7016 KB Output is correct
6 Correct 29 ms 5876 KB Output is correct
7 Correct 54 ms 7096 KB Output is correct
8 Correct 50 ms 7036 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 28 ms 2640 KB Output is correct
24 Correct 34 ms 5740 KB Output is correct
25 Correct 66 ms 8632 KB Output is correct
26 Correct 49 ms 5184 KB Output is correct
27 Correct 41 ms 5508 KB Output is correct
28 Correct 76 ms 7748 KB Output is correct
29 Correct 76 ms 7072 KB Output is correct
30 Correct 38 ms 1852 KB Output is correct
31 Correct 76 ms 7552 KB Output is correct