Submission #734493

# Submission time Handle Problem Language Result Execution time Memory
734493 2023-05-02T14:17:40 Z 1075508020060209tc Intercastellar (JOI22_ho_t1) C++14
100 / 100
441 ms 10820 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
int inf=1e15;
int n;int Q;
int oar[200005];
int ar[200005];
int ps[200005];

signed main(){
cin>>n;
for(int i=1;i<=n;i++){
    cin>>oar[i];
    ps[i]=ps[i-1];
    int v=oar[i];int cnt=0;
    while(v%2==0){
        cnt++;v/=2;
    }
    ar[i]=(1ll<<(cnt));
    if(ps[i-1]>=1e15){continue;}
    ps[i]=ar[i]+ps[i-1];
}
/*
for(int i=1;i<=n;i++){
    cout<<ps[i]<<" ";
}cout<<endl;
*/
cin>>Q;
while(Q--){
    int pl;
    cin>>pl;
    int l=1;int r=n;
    while(l<r){
        int mi=l+(r-l)/2;
        if(ps[mi]>=pl){
            r=mi;
        }else{
            l=mi+1;
        }
    }
    int v=oar[l];
    while(v%2==0){
        v/=2;
    }
    cout<<v<<endl;
}

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 84 ms 5008 KB Output is correct
4 Correct 264 ms 1840 KB Output is correct
5 Correct 327 ms 5452 KB Output is correct
6 Correct 172 ms 4492 KB Output is correct
7 Correct 346 ms 5472 KB Output is correct
8 Correct 357 ms 5420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 304 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 316 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 3 ms 316 KB Output is correct
12 Correct 3 ms 316 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 84 ms 5008 KB Output is correct
4 Correct 264 ms 1840 KB Output is correct
5 Correct 327 ms 5452 KB Output is correct
6 Correct 172 ms 4492 KB Output is correct
7 Correct 346 ms 5472 KB Output is correct
8 Correct 357 ms 5420 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 304 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 316 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 3 ms 316 KB Output is correct
20 Correct 3 ms 316 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 3 ms 340 KB Output is correct
23 Correct 198 ms 3192 KB Output is correct
24 Correct 193 ms 6380 KB Output is correct
25 Correct 408 ms 10508 KB Output is correct
26 Correct 250 ms 6604 KB Output is correct
27 Correct 214 ms 6648 KB Output is correct
28 Correct 441 ms 10736 KB Output is correct
29 Correct 439 ms 10184 KB Output is correct
30 Correct 291 ms 3844 KB Output is correct
31 Correct 431 ms 10820 KB Output is correct