답안 #642745

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
642745 2022-09-20T12:38:22 Z kdn5549 Intercastellar (JOI22_ho_t1) C++17
100 / 100
74 ms 9292 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;
vector<pl> vt;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    ll n; cin>>n;
    for (int i=1;i<=n;i++)
    {
        ll a; cin>>a;
        ll cnt=1;
        while (a%2==0)
        {
            a/=2;
            cnt*=2;
        }
        vt.eb(a,cnt);
    }
    ll q; cin>>q;
    ll c=0,pos=0;
    while (q--)
    {
        ll x; cin>>x;
        while (c<n and pos+vt[c].ss<x)
        {
            pos+=vt[c].ss;
            c++;
        }
        
        cout<<vt[c].ff<<'\n';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 20 ms 4556 KB Output is correct
4 Correct 31 ms 1492 KB Output is correct
5 Correct 42 ms 4556 KB Output is correct
6 Correct 27 ms 5024 KB Output is correct
7 Correct 43 ms 5688 KB Output is correct
8 Correct 54 ms 5728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 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 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 20 ms 4556 KB Output is correct
4 Correct 31 ms 1492 KB Output is correct
5 Correct 42 ms 4556 KB Output is correct
6 Correct 27 ms 5024 KB Output is correct
7 Correct 43 ms 5688 KB Output is correct
8 Correct 54 ms 5728 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 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 3 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 24 ms 3136 KB Output is correct
24 Correct 33 ms 5968 KB Output is correct
25 Correct 59 ms 8912 KB Output is correct
26 Correct 42 ms 5696 KB Output is correct
27 Correct 43 ms 5972 KB Output is correct
28 Correct 74 ms 9292 KB Output is correct
29 Correct 72 ms 8760 KB Output is correct
30 Correct 43 ms 3848 KB Output is correct
31 Correct 72 ms 9232 KB Output is correct