Submission #906921

# Submission time Handle Problem Language Result Execution time Memory
906921 2024-01-15T04:48:30 Z imarn Intercastellar (JOI22_ho_t1) C++14
0 / 100
18 ms 3932 KB
#include<bits/stdc++.h>
#define ld long double
#define pii pair<long long,int>
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define pb push_back
#define f first
#define s second
#define vi vector<ll>
#define vvi vector<vi>
#define vpii vector<pii>
#define ll long long
#define sz(x) (int)x.size()
using namespace std;
int cnt(int x){
    int tt=0;
    while(x%2==0)tt++,x>>=1;
    return tt;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;cin>>n;
    ll a[n+1];for(int i=1;i<=n;i++)cin>>a[i];
    ll qs[n+1];
    qs[1]=cnt(a[1])+1;
    for(int i=2;i<=n;i++)qs[i]=qs[i-1]+(1<<cnt(a[i]));
    int q;cin>>q;
    for(int i=1;i<=n;i++)while(a[i]%2==0)a[i]>>=1;
    while(q--){
        ll x;cin>>x;
        int id = lower_bound(qs+1,qs+n+1,x)-qs;
        cout<<a[id]<<'\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 18 ms 3932 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Incorrect 1 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 18 ms 3932 KB Output isn't correct
4 Halted 0 ms 0 KB -