Submission #499381

# Submission time Handle Problem Language Result Execution time Memory
499381 2021-12-28T09:28:17 Z Stickfish Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 300 KB
#include <iostream>
using namespace std;
using ll = long long;

const int MAXN = 2077;
ll a[MAXN];
ll minsg_[MAXN]; 
ll* minsg = minsg_ + 1;

signed main() {
    int n, A, B;
    cin >> n >> A >> B;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    if (A == 1) {
        ll ans = 0;
        for (ll bt = 45; bt >= 0; --bt) {
            for (int i = 0; i < n; ++i)
                minsg[i] = MAXN;
            for (int i = 0; i < n; ++i) {
                ll sm = 0;
                for (int j = i; j >= 0; --j) {
                    sm += a[j];
                    if ((sm - (sm & ans)) < (1ll << bt)) {
                        minsg[i] = min(minsg[i], minsg[j - 1]);
                    }
                }
            }
            if (minsg[n - 1] > B) {
                ans |= (1 << bt);
            }
        }
        cout << ans << endl;
    } else {

    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 1 ms 296 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 276 KB Output is correct
5 Incorrect 0 ms 296 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 1 ms 300 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 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 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 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 Incorrect 1 ms 292 KB Output isn't correct
6 Halted 0 ms 0 KB -