Submission #124014

# Submission time Handle Problem Language Result Execution time Memory
124014 2019-07-02T11:09:03 Z amiratou Bali Sculptures (APIO15_sculpture) C++14
21 / 100
56 ms 49400 KB
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 100000000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
ll tab[2500],dp[2500][2500];
int n,A,B;
ll solve(int idx,int k){
    if(idx==n&&(k>=A)&&(k<=B))return 0LL;
    if(idx==n||(k>B))return LLONG_MAX;
    if(dp[idx][k]!=-1)
        return dp[idx][k];
    ll ans=LLONG_MAX,sum=0;
    for (int i = idx; i < n; ++i)
        sum+=tab[i],ans=min(ans,sum|solve(i+1,k+1));
    return dp[idx][k]=ans;
}
int main(){
    boost;
    memset(dp,-1,sizeof dp);
    cin>>n>>A>>B;
    for (int i = 0; i < n; ++i)
        cin>>tab[i];
    cout<<solve(0,0);
    return 0;
}
//long long
//array bounds
//special cases
//binary search
# Verdict Execution time Memory Grader output
1 Correct 51 ms 49272 KB Output is correct
2 Correct 43 ms 49272 KB Output is correct
3 Correct 43 ms 49272 KB Output is correct
4 Correct 43 ms 49280 KB Output is correct
5 Correct 43 ms 49272 KB Output is correct
6 Correct 43 ms 49400 KB Output is correct
7 Correct 42 ms 49244 KB Output is correct
8 Correct 42 ms 49272 KB Output is correct
9 Correct 43 ms 49272 KB Output is correct
10 Correct 43 ms 49244 KB Output is correct
11 Correct 44 ms 49272 KB Output is correct
12 Correct 50 ms 49272 KB Output is correct
13 Correct 43 ms 49272 KB Output is correct
14 Correct 43 ms 49272 KB Output is correct
15 Correct 51 ms 49272 KB Output is correct
16 Correct 42 ms 49208 KB Output is correct
17 Correct 43 ms 49272 KB Output is correct
18 Correct 51 ms 49272 KB Output is correct
19 Correct 51 ms 49240 KB Output is correct
20 Correct 43 ms 49272 KB Output is correct
21 Incorrect 43 ms 49272 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 43 ms 49244 KB Output is correct
2 Correct 43 ms 49232 KB Output is correct
3 Correct 43 ms 49272 KB Output is correct
4 Correct 43 ms 49272 KB Output is correct
5 Correct 43 ms 49400 KB Output is correct
6 Correct 43 ms 49196 KB Output is correct
7 Correct 42 ms 49272 KB Output is correct
8 Correct 42 ms 49272 KB Output is correct
9 Correct 50 ms 49244 KB Output is correct
10 Correct 43 ms 49272 KB Output is correct
11 Correct 50 ms 49272 KB Output is correct
12 Correct 48 ms 49400 KB Output is correct
13 Correct 43 ms 49272 KB Output is correct
14 Correct 50 ms 49272 KB Output is correct
15 Correct 42 ms 49272 KB Output is correct
16 Correct 42 ms 49272 KB Output is correct
17 Correct 42 ms 49272 KB Output is correct
18 Correct 43 ms 49272 KB Output is correct
19 Correct 42 ms 49276 KB Output is correct
20 Correct 43 ms 49272 KB Output is correct
21 Incorrect 43 ms 49272 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 42 ms 49272 KB Output is correct
2 Correct 50 ms 49220 KB Output is correct
3 Correct 42 ms 49188 KB Output is correct
4 Correct 42 ms 49272 KB Output is correct
5 Correct 42 ms 49272 KB Output is correct
6 Correct 43 ms 49272 KB Output is correct
7 Correct 42 ms 49248 KB Output is correct
8 Correct 42 ms 49272 KB Output is correct
9 Correct 42 ms 49400 KB Output is correct
10 Correct 43 ms 49244 KB Output is correct
11 Correct 43 ms 49272 KB Output is correct
12 Correct 43 ms 49272 KB Output is correct
13 Correct 43 ms 49272 KB Output is correct
14 Correct 43 ms 49248 KB Output is correct
15 Correct 43 ms 49400 KB Output is correct
16 Correct 42 ms 49272 KB Output is correct
17 Correct 43 ms 49272 KB Output is correct
18 Correct 43 ms 49272 KB Output is correct
19 Correct 43 ms 49312 KB Output is correct
20 Correct 43 ms 49264 KB Output is correct
21 Correct 43 ms 49272 KB Output is correct
22 Correct 43 ms 49272 KB Output is correct
23 Correct 43 ms 49276 KB Output is correct
24 Correct 42 ms 49272 KB Output is correct
25 Correct 43 ms 49272 KB Output is correct
26 Correct 43 ms 49272 KB Output is correct
27 Correct 43 ms 49272 KB Output is correct
28 Correct 44 ms 49272 KB Output is correct
29 Correct 52 ms 49272 KB Output is correct
30 Correct 43 ms 49272 KB Output is correct
31 Correct 43 ms 49244 KB Output is correct
32 Correct 44 ms 49272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 49272 KB Output is correct
2 Correct 43 ms 49244 KB Output is correct
3 Correct 50 ms 49272 KB Output is correct
4 Correct 42 ms 49272 KB Output is correct
5 Correct 51 ms 49272 KB Output is correct
6 Correct 43 ms 49272 KB Output is correct
7 Correct 43 ms 49316 KB Output is correct
8 Correct 51 ms 49272 KB Output is correct
9 Correct 51 ms 49292 KB Output is correct
10 Correct 43 ms 49288 KB Output is correct
11 Correct 42 ms 49276 KB Output is correct
12 Correct 43 ms 49272 KB Output is correct
13 Correct 42 ms 49400 KB Output is correct
14 Correct 42 ms 49272 KB Output is correct
15 Correct 42 ms 49304 KB Output is correct
16 Correct 42 ms 49272 KB Output is correct
17 Correct 43 ms 49204 KB Output is correct
18 Correct 42 ms 49272 KB Output is correct
19 Correct 42 ms 49220 KB Output is correct
20 Correct 54 ms 49272 KB Output is correct
21 Incorrect 49 ms 49272 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 56 ms 49316 KB Output is correct
2 Correct 43 ms 49272 KB Output is correct
3 Correct 51 ms 49244 KB Output is correct
4 Correct 43 ms 49244 KB Output is correct
5 Correct 42 ms 49272 KB Output is correct
6 Correct 43 ms 49272 KB Output is correct
7 Correct 50 ms 49272 KB Output is correct
8 Correct 44 ms 49272 KB Output is correct
9 Correct 43 ms 49272 KB Output is correct
10 Correct 42 ms 49272 KB Output is correct
11 Correct 42 ms 49272 KB Output is correct
12 Correct 42 ms 49272 KB Output is correct
13 Correct 43 ms 49272 KB Output is correct
14 Correct 43 ms 49272 KB Output is correct
15 Correct 51 ms 49272 KB Output is correct
16 Correct 50 ms 49272 KB Output is correct
17 Correct 43 ms 49272 KB Output is correct
18 Incorrect 43 ms 49272 KB Output isn't correct
19 Halted 0 ms 0 KB -