Submission #528115

# Submission time Handle Problem Language Result Execution time Memory
528115 2022-02-19T10:04:49 Z doowey Intercastellar (JOI22_ho_t1) C++14
100 / 100
78 ms 8836 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)2e5 + 10;
ll A[N];
ll C[N];

int main(){
    fastIO;
    //freopen("in.txt","r",stdin);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i ++ ){
        cin >> A[i];
        C[i] = 1;
        while(A[i] % 2 == 0){
            A[i] /= 2;
            C[i] *= 2ll;
        }
    }
    int q;
    cin >> q;
    ll X;
    int id = 0;
    ll cum = 0;
    for(int i = 1; i <= q; i ++ ){
        cin >> X;
        while(cum + C[id + 1] < X){
            cum += C[id + 1];
            id ++ ;
        }
        cout << A[id + 1] << "\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 18 ms 3896 KB Output is correct
4 Correct 25 ms 2116 KB Output is correct
5 Correct 42 ms 4852 KB Output is correct
6 Correct 25 ms 4036 KB Output is correct
7 Correct 53 ms 4964 KB Output is correct
8 Correct 50 ms 5556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 324 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 18 ms 3896 KB Output is correct
4 Correct 25 ms 2116 KB Output is correct
5 Correct 42 ms 4852 KB Output is correct
6 Correct 25 ms 4036 KB Output is correct
7 Correct 53 ms 4964 KB Output is correct
8 Correct 50 ms 5556 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 324 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 33 ms 2880 KB Output is correct
24 Correct 33 ms 4804 KB Output is correct
25 Correct 59 ms 8036 KB Output is correct
26 Correct 40 ms 5188 KB Output is correct
27 Correct 39 ms 4976 KB Output is correct
28 Correct 71 ms 8832 KB Output is correct
29 Correct 67 ms 7968 KB Output is correct
30 Correct 36 ms 3560 KB Output is correct
31 Correct 78 ms 8836 KB Output is correct