# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41519 | 2018-02-18T04:43:23 Z | wzy | Bali Sculptures (APIO15_sculpture) | C++14 | 3 ms | 992 KB |
#include <bits/stdc++.h> using namespace std; #define int long long int y[2500] , dp[150][150]; int n , a ,b; int solve(int i , int j){ if(i == n + 1){ if(j >= a && j <= b) return 0; else return 9223372036854775807; } if(dp[i][j] != -1) return dp[i][j]; for(int w = i ; w <= n; w++){ if(w == i) dp[i][j] = solve(w + 1 , j + 1) | (y[w] - y[i-1]); else dp[i][j] = min((solve(w + 1 , j + 1) )|(y[w] - y[i-1]) , dp[i][j]); } return dp[i][j]; } int32_t main(){ scanf("%lld%lld%lld" , &n , &a , &b); y[0] = 0; for(int i = 1 ; i <= n; i++){ scanf("%lld" , & y[i]); y[i] += y[i-1]; } for(int i = 0 ; i < 150 ; i++){ for(int j = 0 ; j < 150 ; j++) dp[i][j] = -1; } printf("%lld\n" , solve(1,0)); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 504 KB | Output is correct |
2 | Correct | 1 ms | 504 KB | Output is correct |
3 | Correct | 1 ms | 552 KB | Output is correct |
4 | Correct | 2 ms | 624 KB | Output is correct |
5 | Correct | 2 ms | 696 KB | Output is correct |
6 | Correct | 2 ms | 788 KB | Output is correct |
7 | Correct | 1 ms | 824 KB | Output is correct |
8 | Correct | 2 ms | 836 KB | Output is correct |
9 | Correct | 2 ms | 836 KB | Output is correct |
10 | Correct | 1 ms | 836 KB | Output is correct |
11 | Correct | 2 ms | 836 KB | Output is correct |
12 | Correct | 2 ms | 836 KB | Output is correct |
13 | Correct | 2 ms | 836 KB | Output is correct |
14 | Correct | 2 ms | 836 KB | Output is correct |
15 | Correct | 2 ms | 836 KB | Output is correct |
16 | Correct | 1 ms | 836 KB | Output is correct |
17 | Correct | 1 ms | 836 KB | Output is correct |
18 | Correct | 2 ms | 836 KB | Output is correct |
19 | Correct | 2 ms | 836 KB | Output is correct |
20 | Correct | 1 ms | 836 KB | Output is correct |
21 | Incorrect | 2 ms | 836 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 836 KB | Output is correct |
2 | Correct | 1 ms | 836 KB | Output is correct |
3 | Correct | 1 ms | 836 KB | Output is correct |
4 | Correct | 2 ms | 836 KB | Output is correct |
5 | Correct | 2 ms | 836 KB | Output is correct |
6 | Correct | 2 ms | 836 KB | Output is correct |
7 | Correct | 1 ms | 836 KB | Output is correct |
8 | Correct | 1 ms | 836 KB | Output is correct |
9 | Correct | 2 ms | 836 KB | Output is correct |
10 | Correct | 1 ms | 836 KB | Output is correct |
11 | Correct | 2 ms | 836 KB | Output is correct |
12 | Correct | 2 ms | 836 KB | Output is correct |
13 | Correct | 1 ms | 836 KB | Output is correct |
14 | Correct | 1 ms | 836 KB | Output is correct |
15 | Correct | 2 ms | 836 KB | Output is correct |
16 | Correct | 2 ms | 836 KB | Output is correct |
17 | Correct | 1 ms | 836 KB | Output is correct |
18 | Correct | 2 ms | 836 KB | Output is correct |
19 | Correct | 1 ms | 836 KB | Output is correct |
20 | Correct | 2 ms | 836 KB | Output is correct |
21 | Incorrect | 2 ms | 836 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 836 KB | Output is correct |
2 | Correct | 2 ms | 836 KB | Output is correct |
3 | Correct | 2 ms | 836 KB | Output is correct |
4 | Correct | 1 ms | 836 KB | Output is correct |
5 | Correct | 1 ms | 836 KB | Output is correct |
6 | Correct | 2 ms | 836 KB | Output is correct |
7 | Correct | 2 ms | 836 KB | Output is correct |
8 | Correct | 2 ms | 836 KB | Output is correct |
9 | Correct | 1 ms | 836 KB | Output is correct |
10 | Correct | 1 ms | 836 KB | Output is correct |
11 | Correct | 2 ms | 836 KB | Output is correct |
12 | Correct | 1 ms | 836 KB | Output is correct |
13 | Correct | 1 ms | 868 KB | Output is correct |
14 | Correct | 2 ms | 868 KB | Output is correct |
15 | Correct | 2 ms | 868 KB | Output is correct |
16 | Correct | 2 ms | 884 KB | Output is correct |
17 | Correct | 2 ms | 888 KB | Output is correct |
18 | Correct | 2 ms | 888 KB | Output is correct |
19 | Correct | 2 ms | 888 KB | Output is correct |
20 | Correct | 2 ms | 888 KB | Output is correct |
21 | Correct | 2 ms | 888 KB | Output is correct |
22 | Correct | 2 ms | 888 KB | Output is correct |
23 | Correct | 2 ms | 888 KB | Output is correct |
24 | Correct | 2 ms | 888 KB | Output is correct |
25 | Correct | 2 ms | 888 KB | Output is correct |
26 | Correct | 2 ms | 888 KB | Output is correct |
27 | Correct | 2 ms | 888 KB | Output is correct |
28 | Correct | 2 ms | 888 KB | Output is correct |
29 | Correct | 2 ms | 888 KB | Output is correct |
30 | Correct | 2 ms | 888 KB | Output is correct |
31 | Correct | 2 ms | 888 KB | Output is correct |
32 | Correct | 3 ms | 888 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 888 KB | Output is correct |
2 | Correct | 2 ms | 888 KB | Output is correct |
3 | Correct | 1 ms | 888 KB | Output is correct |
4 | Correct | 1 ms | 888 KB | Output is correct |
5 | Correct | 1 ms | 888 KB | Output is correct |
6 | Correct | 2 ms | 888 KB | Output is correct |
7 | Correct | 2 ms | 888 KB | Output is correct |
8 | Correct | 2 ms | 888 KB | Output is correct |
9 | Correct | 2 ms | 888 KB | Output is correct |
10 | Correct | 2 ms | 888 KB | Output is correct |
11 | Correct | 1 ms | 892 KB | Output is correct |
12 | Correct | 2 ms | 896 KB | Output is correct |
13 | Correct | 1 ms | 900 KB | Output is correct |
14 | Correct | 2 ms | 904 KB | Output is correct |
15 | Correct | 2 ms | 908 KB | Output is correct |
16 | Correct | 1 ms | 912 KB | Output is correct |
17 | Correct | 1 ms | 916 KB | Output is correct |
18 | Correct | 2 ms | 916 KB | Output is correct |
19 | Correct | 2 ms | 924 KB | Output is correct |
20 | Correct | 2 ms | 928 KB | Output is correct |
21 | Incorrect | 1 ms | 932 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 936 KB | Output is correct |
2 | Correct | 2 ms | 936 KB | Output is correct |
3 | Correct | 1 ms | 936 KB | Output is correct |
4 | Correct | 1 ms | 936 KB | Output is correct |
5 | Correct | 2 ms | 940 KB | Output is correct |
6 | Correct | 1 ms | 944 KB | Output is correct |
7 | Correct | 1 ms | 952 KB | Output is correct |
8 | Correct | 2 ms | 952 KB | Output is correct |
9 | Correct | 2 ms | 956 KB | Output is correct |
10 | Correct | 2 ms | 960 KB | Output is correct |
11 | Correct | 2 ms | 964 KB | Output is correct |
12 | Correct | 2 ms | 968 KB | Output is correct |
13 | Correct | 2 ms | 968 KB | Output is correct |
14 | Correct | 1 ms | 976 KB | Output is correct |
15 | Correct | 1 ms | 980 KB | Output is correct |
16 | Correct | 2 ms | 984 KB | Output is correct |
17 | Correct | 2 ms | 988 KB | Output is correct |
18 | Incorrect | 1 ms | 992 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |