Submission #467138

# Submission time Handle Problem Language Result Execution time Memory
467138 2021-08-21T18:59:10 Z SirCovidThe19th Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 292 KB
#include <bits/stdc++.h>
using namespace std; 

int n, a, b; long long ans, A[2005];

bool test(long long bad){
    int lst[b + 1]; fill(lst, lst + b + 1, -1); lst[0] = 0;
    for (int i = 1; i <= n; i++)
        for (int j = min(b, i); j >= 1; j--){
            if (~lst[j - 1] and !((A[i] - A[lst[j - 1]]) & bad))
                lst[j] = i;
            if (i == n and j >= a and j <= b and lst[j] == n)
                return 1;
        }
    return 0;
}

int main(){
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++) 
        cin >> A[i], A[i] += A[i - 1];
    for (long long i = (1LL << 40), bad = 0; i > 0; i /= 2)
        if (!test(bad += i))
            bad -= i, ans += i;
    cout<<ans<<endl;
}
# 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 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 216 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 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 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 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 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 1 ms 236 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 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 292 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -