Submission #962566

# Submission time Handle Problem Language Result Execution time Memory
962566 2024-04-13T20:11:15 Z BhavayGoyal Bali Sculptures (APIO15_sculpture) C++14
50 / 100
130 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T> using oset = 
            tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define ld long double
#define ar array
#define vi vector<int>
#define vii vector<vector<int>>
#define pii pair<int, int>
#define pb push_back
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define endl "\n"

const int MOD = 1e9+7;
const int inf = 1e9;
const int linf = 1e18;

const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


// -------------------------------------------------- Main Code --------------------------------------------------

void sol() {
    int n, a, b; cin >> n >> a >> b;

    int arr[n+1];
    for (int i = 1; i <= n; i++) cin >> arr[i];

    // function<void(int, int)> sol = [&](int idx, int left, int pref) {

    // };

    if (a != 1) {
        // int pref = 0;
        // for (int k = 60; k >= 0; k--) {
        //     for (int i = a; i <= b; i++) {
        //         sol()
        //     }
        // }
    }
    else {
        int pref = 0;
        for (int k = 60; k >= 0; k--) {
            int dpp[n+1]; dpp[0] = 0;
            for (int i = 1; i <= n; i++) {
                int sum = 0;
                dpp[i] = inf;
                for (int j = i; j >= 1; j--) {
                    sum += arr[j];
                    if (((pref>>k)|(sum>>k)) == (pref>>k))
                        dpp[i] = min(dpp[j-1]+1, dpp[i]);
                }
            }
            if (dpp[n] > b) pref |= (1ll<<k);
        }
        cout << pref << endl;
    }
}

signed main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    // cin >> t; 
    while (t--) {
        sol();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Incorrect 0 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Incorrect 0 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Incorrect 0 ms 344 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 500 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 360 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 512 KB Output is correct
18 Correct 0 ms 600 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 456 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 360 KB Output is correct
26 Correct 0 ms 356 KB Output is correct
27 Correct 0 ms 356 KB Output is correct
28 Correct 1 ms 356 KB Output is correct
29 Correct 0 ms 352 KB Output is correct
30 Correct 1 ms 424 KB Output is correct
31 Correct 1 ms 352 KB Output is correct
32 Correct 0 ms 352 KB Output is correct
33 Correct 1 ms 356 KB Output is correct
34 Correct 1 ms 356 KB Output is correct
35 Correct 1 ms 352 KB Output is correct
36 Correct 1 ms 356 KB Output is correct
37 Correct 1 ms 356 KB Output is correct
38 Correct 1 ms 356 KB Output is correct
39 Correct 1 ms 356 KB Output is correct
40 Correct 1 ms 360 KB Output is correct
41 Correct 1 ms 356 KB Output is correct
42 Correct 1 ms 468 KB Output is correct
43 Correct 1 ms 356 KB Output is correct
44 Correct 1 ms 360 KB Output is correct
45 Correct 1 ms 356 KB Output is correct
46 Correct 3 ms 356 KB Output is correct
47 Correct 1 ms 344 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 11 ms 472 KB Output is correct
53 Correct 18 ms 348 KB Output is correct
54 Correct 33 ms 348 KB Output is correct
55 Correct 36 ms 344 KB Output is correct
56 Correct 122 ms 352 KB Output is correct
57 Correct 129 ms 344 KB Output is correct
58 Correct 121 ms 344 KB Output is correct
59 Correct 123 ms 344 KB Output is correct
60 Correct 126 ms 348 KB Output is correct
61 Correct 1 ms 344 KB Output is correct
62 Correct 17 ms 348 KB Output is correct
63 Correct 34 ms 360 KB Output is correct
64 Correct 32 ms 348 KB Output is correct
65 Correct 63 ms 480 KB Output is correct
66 Correct 104 ms 476 KB Output is correct
67 Correct 126 ms 484 KB Output is correct
68 Correct 125 ms 484 KB Output is correct
69 Correct 130 ms 480 KB Output is correct