Submission #642737

# Submission time Handle Problem Language Result Execution time Memory
642737 2022-09-20T12:29:55 Z kdn5549 Intercastellar (JOI22_ho_t1) C++17
35 / 100
2000 ms 6544 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

#define eb emplace_back
#define all(v) v.begin(),v.end()
#define ff first
#define ss second

const ll mxn=2e5+5;
ll a[mxn];
vector<pl> vt;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    ll n; cin>>n;
    for (int i=1;i<=n;i++)
    {
        cin>>a[i];
        ll cnt=1;
        while (a[i]%2==0)
        {
            a[i]/=2;
            cnt*=2;
        }
        vt.eb(a[i],cnt);
    }
    ll q; cin>>q;
    while (q--)
    {
        ll x; cin>>x;
        ll c=0,pos=0;
        while (c<n and pos+vt[c].ss<x)
        {
            pos+=vt[c].ss;
            c++;
        }
        
        cout<<vt[c].ff<<'\n';
    }
}
# 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 1891 ms 6056 KB Output is correct
4 Correct 1972 ms 2880 KB Output is correct
5 Execution timed out 2087 ms 6544 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 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 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 336 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 1891 ms 6056 KB Output is correct
4 Correct 1972 ms 2880 KB Output is correct
5 Execution timed out 2087 ms 6544 KB Time limit exceeded
6 Halted 0 ms 0 KB -