Submission #970668

# Submission time Handle Problem Language Result Execution time Memory
970668 2024-04-27T04:07:52 Z detectivebowon Intercastellar (JOI22_ho_t1) C++14
0 / 100
1 ms 600 KB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,two[37];
vector<ll> posi,value;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    for(int i=0;i<=30;i++)
    {
        two[i]=(1<<i);
    }
    cin>>n;
    posi.emplace_back(1);
    value.emplace_back(-1);
    for(int i=1;i<=n;i++)
    {
        ll num;
        cin>>num;
        ll size=0;
        for(int i=0;i<=30;i++)
        {
            if(two[i]>num) break;
            if(num%two[i]==0)
            {
                size=two[i];
            }
        }
        if(posi.size()==1)
            posi.emplace_back(size);
        else
            posi.emplace_back(posi[posi.size()-1]+size);
        value.emplace_back(num/size);
    }
    int q;
    cin>>q;
    while(q--)
    {
        ll tmp;
        cin>>tmp;
        int it=lower_bound(posi.begin(),posi.end(),tmp)-posi.begin();
        cout<<value[it]<<"\n";
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -