Submission #777082

# Submission time Handle Problem Language Result Execution time Memory
777082 2023-07-08T15:54:32 Z LinkedArray Intercastellar (JOI22_ho_t1) C++17
100 / 100
66 ms 6860 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 2e5;

int a[MAXN];

int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(0);

    int n, q, i, pnt;
    long long p2 = 0, x;

    cin >> n;
    for(i = 0; i < n; i++){
        cin >> a[i];
    }

    cin >> q;
    pnt = -1; // We start from -1, since we want our first pnt to be 0 (x + 1 = 0 => x = 0 - 1 => x = -1)
    for(i = 0; i < q; i++){
        cin >> x;
        while(p2 < x){
            ++pnt; // Update our pointer
            long long put2 = 1;
            while(a[pnt] % 2 == 0){ // While our number is still divisible with 2
                a[pnt] /= 2; // Divide
                put2 *= 2; // and update our power
            }
            // This means that now put2 * a[pnt] = original a[pnt]
            p2 += put2; // And we just add this value to our total one
        }
        cout << a[pnt] << "\n";
    }
    return 0;
}
# 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 14 ms 1752 KB Output is correct
4 Correct 22 ms 1740 KB Output is correct
5 Correct 38 ms 3132 KB Output is correct
6 Correct 21 ms 2004 KB Output is correct
7 Correct 37 ms 3164 KB Output is correct
8 Correct 39 ms 3224 KB Output is correct
# 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 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 1 ms 280 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# 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 14 ms 1752 KB Output is correct
4 Correct 22 ms 1740 KB Output is correct
5 Correct 38 ms 3132 KB Output is correct
6 Correct 21 ms 2004 KB Output is correct
7 Correct 37 ms 3164 KB Output is correct
8 Correct 39 ms 3224 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 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 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 1 ms 280 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 22 ms 2628 KB Output is correct
24 Correct 26 ms 3500 KB Output is correct
25 Correct 49 ms 6440 KB Output is correct
26 Correct 33 ms 4040 KB Output is correct
27 Correct 30 ms 3904 KB Output is correct
28 Correct 55 ms 6860 KB Output is correct
29 Correct 55 ms 6348 KB Output is correct
30 Correct 31 ms 3336 KB Output is correct
31 Correct 66 ms 6768 KB Output is correct