Submission #549116

# Submission time Handle Problem Language Result Execution time Memory
549116 2022-04-15T08:41:24 Z CyberSleeper Bali Sculptures (APIO15_sculpture) C++14
0 / 100
43 ms 3668 KB
#include <bits/stdc++.h>
#define fastio      ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define debug(x)    cout << "Line " << __LINE__ << ", " << #x << " is " << x << endl
#define all(x)      x.begin(), x.end()
#define fi          first
#define se          second
#define mp          make_pair
#define pb          push_back
#define ll          long long
#define ull         unsigned long long
#define pll         pair<ll, ll>
#define pii         pair<ll, ll>
#define ld          long double
#define nl          endl
#define tb          '\t'
#define sp          ' '
#define sqr(x)      (x)*(x)
#define arr3        array<int, 3>
using namespace std;

const ll MX=2002, MOD=1000000007, BLOCK=327, INF=2e9+7;
const ll INFF=1000000000000000007;
const ld ERR=1e-6, pi=3.14159265358979323846;

ll N, L, R, A[MX], pref[MX], DP[105][2005], ans=INF;

ll getp(int le, int ri){
    return pref[ri]-pref[le-1];
}

int main(){
    fastio;
    cin >> N >> L >> R;
    for(int i=0; i<=100; i++)
        for(int j=0; j<=2000; j++)
            DP[i][j]=INF;
    for(int i=1; i<=N; i++){
        cin >> A[i];
        assert(A[i]<=20);
        pref[i]=pref[i-1]+A[i];
    }
    DP[1][0]=0;
    for(int i=1; i<=N; i++){
        for(int j=0; j<=2000; j++){
            for(int k=i; k<=N; k++){
                int tmp=j|getp(i, k);
                DP[k+1][tmp]=min(DP[k+1][tmp], DP[i][j]+1);
            }
        }
    }
    for(int i=0; i<=2000; i++){
        if(DP[N+1][i]>=L && DP[N+1][i]<=R){
            cout << i << nl;
            return 0;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 2 ms 1876 KB Output is correct
6 Correct 2 ms 1916 KB Output is correct
7 Correct 2 ms 1876 KB Output is correct
8 Correct 3 ms 1876 KB Output is correct
9 Correct 3 ms 1876 KB Output is correct
10 Correct 3 ms 1876 KB Output is correct
11 Correct 3 ms 1876 KB Output is correct
12 Correct 3 ms 1876 KB Output is correct
13 Correct 3 ms 1876 KB Output is correct
14 Correct 2 ms 1876 KB Output is correct
15 Incorrect 2 ms 1896 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 2 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 2 ms 1876 KB Output is correct
6 Correct 2 ms 1876 KB Output is correct
7 Correct 2 ms 1876 KB Output is correct
8 Correct 3 ms 1876 KB Output is correct
9 Correct 3 ms 1876 KB Output is correct
10 Correct 3 ms 1876 KB Output is correct
11 Correct 3 ms 1876 KB Output is correct
12 Correct 3 ms 1876 KB Output is correct
13 Correct 3 ms 1876 KB Output is correct
14 Correct 1 ms 1876 KB Output is correct
15 Incorrect 1 ms 1876 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 1 ms 1792 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 2 ms 1876 KB Output is correct
6 Correct 2 ms 1876 KB Output is correct
7 Correct 2 ms 1876 KB Output is correct
8 Correct 3 ms 1876 KB Output is correct
9 Correct 3 ms 1876 KB Output is correct
10 Correct 3 ms 1876 KB Output is correct
11 Correct 3 ms 1876 KB Output is correct
12 Correct 3 ms 1876 KB Output is correct
13 Correct 3 ms 1876 KB Output is correct
14 Correct 3 ms 1912 KB Output is correct
15 Correct 4 ms 1876 KB Output is correct
16 Correct 7 ms 1912 KB Output is correct
17 Correct 9 ms 1876 KB Output is correct
18 Correct 12 ms 1876 KB Output is correct
19 Correct 13 ms 1908 KB Output is correct
20 Correct 10 ms 1876 KB Output is correct
21 Correct 8 ms 1876 KB Output is correct
22 Correct 10 ms 1876 KB Output is correct
23 Correct 13 ms 1876 KB Output is correct
24 Correct 12 ms 1908 KB Output is correct
25 Correct 20 ms 1912 KB Output is correct
26 Correct 27 ms 1876 KB Output is correct
27 Correct 36 ms 1892 KB Output is correct
28 Incorrect 43 ms 1876 KB Output isn't correct
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 2 ms 1876 KB Output is correct
6 Correct 2 ms 1876 KB Output is correct
7 Correct 2 ms 1876 KB Output is correct
8 Correct 3 ms 1876 KB Output is correct
9 Correct 3 ms 1876 KB Output is correct
10 Correct 3 ms 1876 KB Output is correct
11 Correct 3 ms 1876 KB Output is correct
12 Correct 3 ms 1876 KB Output is correct
13 Correct 3 ms 1876 KB Output is correct
14 Correct 1 ms 1876 KB Output is correct
15 Incorrect 1 ms 1876 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 1 ms 1876 KB Output is correct
6 Correct 2 ms 1876 KB Output is correct
7 Correct 3 ms 1876 KB Output is correct
8 Correct 3 ms 1876 KB Output is correct
9 Correct 3 ms 1876 KB Output is correct
10 Correct 3 ms 1876 KB Output is correct
11 Correct 3 ms 1920 KB Output is correct
12 Correct 3 ms 1844 KB Output is correct
13 Correct 3 ms 1876 KB Output is correct
14 Runtime error 3 ms 3668 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -