제출 #1187844

#제출 시각아이디문제언어결과실행 시간메모리
1187844maxFedorchukIntercastellar (JOI22_ho_t1)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    vector < pair < long long , long long > > vc;

    long long n;
    cin>>n;

    for(long long i=1;i<=n;i++)
    {
        long long a,k=1;
        cin>>a;

        while(a%2==0)
        {
            a/=2;
            k*=2;
        }

        vc.push_back({a,k});
    }

    for(long long i=1;i<n;i++)
    {
        vc[i].second+=vc[i-1].second;
    }

    for(auto [a,b]:vc)
    {
        cout<<a<<" "<<b<<"\n";
    }

    long long q,uk=0;
    cin>>q;

    while(q--)
    {
        long long a;
        cin>>a;

        while(vc[uk].second<a)
        {
            uk++;
        }

        cout<<vc[uk].first<<"\n";
    }
    
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...