Submission #23117

# Submission time Handle Problem Language Result Execution time Memory
23117 2017-05-03T07:47:17 Z ngkan146 Bali Sculptures (APIO15_sculpture) C++
71 / 100
1000 ms 5960 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,a,b,x[2005];
ll res = 0;
bool dp[2005][2005];
int main(){
   cin >> n >> a >> b;
   for(int i=1;i<=n;i++)
      cin >> x[i];
   for(int bit=40;bit>=0;bit--){
      memset(dp,0,sizeof(dp));
      dp[0][0] = 1;
      for(int i=0;i<=n;i++){
         for(int j=0;j<=i;j++){
            if (!dp[i][j]) continue;
            ll sum = 0;
            for(int k=i+1;k<=n;k++){
               sum += x[k];
               if (((sum>>bit)|(res>>bit)) == (res>>bit))
                  dp[k][j+1] = 1;
            }
         }
      }
      bool ok = 0;
      for(int j=a;j<=b;j++)
         if (dp[n][j]) ok = 1;
      if (!ok) res += (1ll<<bit);
   }
   cout << res;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 5960 KB Output is correct
2 Correct 6 ms 5960 KB Output is correct
3 Correct 6 ms 5960 KB Output is correct
4 Correct 9 ms 5960 KB Output is correct
5 Correct 9 ms 5960 KB Output is correct
6 Correct 9 ms 5960 KB Output is correct
7 Correct 6 ms 5960 KB Output is correct
8 Correct 6 ms 5960 KB Output is correct
9 Correct 9 ms 5960 KB Output is correct
10 Correct 9 ms 5960 KB Output is correct
11 Correct 9 ms 5960 KB Output is correct
12 Correct 6 ms 5960 KB Output is correct
13 Correct 6 ms 5960 KB Output is correct
14 Correct 9 ms 5960 KB Output is correct
15 Correct 9 ms 5960 KB Output is correct
16 Correct 9 ms 5960 KB Output is correct
17 Correct 6 ms 5960 KB Output is correct
18 Correct 9 ms 5960 KB Output is correct
19 Correct 9 ms 5960 KB Output is correct
20 Correct 6 ms 5960 KB Output is correct
21 Correct 6 ms 5960 KB Output is correct
22 Correct 9 ms 5960 KB Output is correct
23 Correct 9 ms 5960 KB Output is correct
24 Correct 9 ms 5960 KB Output is correct
25 Correct 9 ms 5960 KB Output is correct
26 Correct 9 ms 5960 KB Output is correct
27 Correct 9 ms 5960 KB Output is correct
28 Correct 6 ms 5960 KB Output is correct
29 Correct 9 ms 5960 KB Output is correct
30 Correct 6 ms 5960 KB Output is correct
31 Correct 9 ms 5960 KB Output is correct
32 Correct 9 ms 5960 KB Output is correct
33 Correct 9 ms 5960 KB Output is correct
34 Correct 6 ms 5960 KB Output is correct
35 Correct 6 ms 5960 KB Output is correct
36 Correct 6 ms 5960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 5960 KB Output is correct
2 Correct 9 ms 5960 KB Output is correct
3 Correct 6 ms 5960 KB Output is correct
4 Correct 6 ms 5960 KB Output is correct
5 Correct 9 ms 5960 KB Output is correct
6 Correct 13 ms 5960 KB Output is correct
7 Correct 9 ms 5960 KB Output is correct
8 Correct 9 ms 5960 KB Output is correct
9 Correct 9 ms 5960 KB Output is correct
10 Correct 9 ms 5960 KB Output is correct
11 Correct 9 ms 5960 KB Output is correct
12 Correct 6 ms 5960 KB Output is correct
13 Correct 9 ms 5960 KB Output is correct
14 Correct 9 ms 5960 KB Output is correct
15 Correct 6 ms 5960 KB Output is correct
16 Correct 9 ms 5960 KB Output is correct
17 Correct 6 ms 5960 KB Output is correct
18 Correct 9 ms 5960 KB Output is correct
19 Correct 9 ms 5960 KB Output is correct
20 Correct 6 ms 5960 KB Output is correct
21 Correct 9 ms 5960 KB Output is correct
22 Correct 9 ms 5960 KB Output is correct
23 Correct 6 ms 5960 KB Output is correct
24 Correct 9 ms 5960 KB Output is correct
25 Correct 6 ms 5960 KB Output is correct
26 Correct 6 ms 5960 KB Output is correct
27 Correct 9 ms 5960 KB Output is correct
28 Correct 6 ms 5960 KB Output is correct
29 Correct 9 ms 5960 KB Output is correct
30 Correct 6 ms 5960 KB Output is correct
31 Correct 13 ms 5960 KB Output is correct
32 Correct 9 ms 5960 KB Output is correct
33 Correct 9 ms 5960 KB Output is correct
34 Correct 9 ms 5960 KB Output is correct
35 Correct 13 ms 5960 KB Output is correct
36 Correct 9 ms 5960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 5960 KB Output is correct
2 Correct 9 ms 5960 KB Output is correct
3 Correct 6 ms 5960 KB Output is correct
4 Correct 9 ms 5960 KB Output is correct
5 Correct 9 ms 5960 KB Output is correct
6 Correct 9 ms 5960 KB Output is correct
7 Correct 9 ms 5960 KB Output is correct
8 Correct 9 ms 5960 KB Output is correct
9 Correct 9 ms 5960 KB Output is correct
10 Correct 9 ms 5960 KB Output is correct
11 Correct 6 ms 5960 KB Output is correct
12 Correct 9 ms 5960 KB Output is correct
13 Correct 9 ms 5960 KB Output is correct
14 Correct 6 ms 5960 KB Output is correct
15 Correct 9 ms 5960 KB Output is correct
16 Correct 9 ms 5960 KB Output is correct
17 Correct 9 ms 5960 KB Output is correct
18 Correct 9 ms 5960 KB Output is correct
19 Correct 9 ms 5960 KB Output is correct
20 Correct 9 ms 5960 KB Output is correct
21 Correct 6 ms 5960 KB Output is correct
22 Correct 9 ms 5960 KB Output is correct
23 Correct 9 ms 5960 KB Output is correct
24 Correct 9 ms 5960 KB Output is correct
25 Correct 13 ms 5960 KB Output is correct
26 Correct 16 ms 5960 KB Output is correct
27 Correct 16 ms 5960 KB Output is correct
28 Correct 16 ms 5960 KB Output is correct
29 Correct 23 ms 5960 KB Output is correct
30 Correct 23 ms 5960 KB Output is correct
31 Correct 19 ms 5960 KB Output is correct
32 Correct 29 ms 5960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 5960 KB Output is correct
2 Correct 6 ms 5960 KB Output is correct
3 Correct 9 ms 5960 KB Output is correct
4 Correct 9 ms 5960 KB Output is correct
5 Correct 6 ms 5960 KB Output is correct
6 Correct 9 ms 5960 KB Output is correct
7 Correct 9 ms 5960 KB Output is correct
8 Correct 9 ms 5960 KB Output is correct
9 Correct 6 ms 5960 KB Output is correct
10 Correct 9 ms 5960 KB Output is correct
11 Correct 9 ms 5960 KB Output is correct
12 Correct 9 ms 5960 KB Output is correct
13 Correct 9 ms 5960 KB Output is correct
14 Correct 6 ms 5960 KB Output is correct
15 Correct 9 ms 5960 KB Output is correct
16 Correct 9 ms 5960 KB Output is correct
17 Correct 9 ms 5960 KB Output is correct
18 Correct 9 ms 5960 KB Output is correct
19 Correct 9 ms 5960 KB Output is correct
20 Correct 6 ms 5960 KB Output is correct
21 Correct 9 ms 5960 KB Output is correct
22 Correct 9 ms 5960 KB Output is correct
23 Correct 6 ms 5960 KB Output is correct
24 Correct 9 ms 5960 KB Output is correct
25 Correct 9 ms 5960 KB Output is correct
26 Correct 6 ms 5960 KB Output is correct
27 Correct 6 ms 5960 KB Output is correct
28 Correct 13 ms 5960 KB Output is correct
29 Correct 6 ms 5960 KB Output is correct
30 Correct 9 ms 5960 KB Output is correct
31 Correct 6 ms 5960 KB Output is correct
32 Correct 9 ms 5960 KB Output is correct
33 Correct 9 ms 5960 KB Output is correct
34 Correct 9 ms 5960 KB Output is correct
35 Correct 9 ms 5960 KB Output is correct
36 Correct 9 ms 5960 KB Output is correct
37 Correct 6 ms 5960 KB Output is correct
38 Correct 6 ms 5960 KB Output is correct
39 Correct 9 ms 5960 KB Output is correct
40 Correct 9 ms 5960 KB Output is correct
41 Correct 9 ms 5960 KB Output is correct
42 Correct 9 ms 5960 KB Output is correct
43 Correct 13 ms 5960 KB Output is correct
44 Correct 9 ms 5960 KB Output is correct
45 Correct 9 ms 5960 KB Output is correct
46 Correct 9 ms 5960 KB Output is correct
47 Correct 9 ms 5960 KB Output is correct
48 Correct 16 ms 5960 KB Output is correct
49 Correct 13 ms 5960 KB Output is correct
50 Correct 16 ms 5960 KB Output is correct
51 Correct 19 ms 5960 KB Output is correct
52 Correct 19 ms 5960 KB Output is correct
53 Correct 23 ms 5960 KB Output is correct
54 Correct 19 ms 5960 KB Output is correct
55 Correct 19 ms 5960 KB Output is correct
56 Correct 6 ms 5960 KB Output is correct
57 Correct 13 ms 5960 KB Output is correct
58 Correct 9 ms 5960 KB Output is correct
59 Correct 13 ms 5960 KB Output is correct
60 Correct 9 ms 5960 KB Output is correct
61 Correct 9 ms 5960 KB Output is correct
62 Correct 13 ms 5960 KB Output is correct
63 Correct 13 ms 5960 KB Output is correct
64 Correct 19 ms 5960 KB Output is correct
65 Correct 6 ms 5960 KB Output is correct
66 Correct 9 ms 5960 KB Output is correct
67 Correct 9 ms 5960 KB Output is correct
68 Correct 9 ms 5960 KB Output is correct
69 Correct 13 ms 5960 KB Output is correct
70 Correct 13 ms 5960 KB Output is correct
71 Correct 9 ms 5960 KB Output is correct
72 Correct 13 ms 5960 KB Output is correct
73 Correct 13 ms 5960 KB Output is correct
74 Correct 13 ms 5960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 5960 KB Output is correct
2 Correct 6 ms 5960 KB Output is correct
3 Correct 6 ms 5960 KB Output is correct
4 Correct 9 ms 5960 KB Output is correct
5 Correct 9 ms 5960 KB Output is correct
6 Correct 9 ms 5960 KB Output is correct
7 Correct 6 ms 5960 KB Output is correct
8 Correct 9 ms 5960 KB Output is correct
9 Correct 9 ms 5960 KB Output is correct
10 Correct 9 ms 5960 KB Output is correct
11 Correct 6 ms 5960 KB Output is correct
12 Correct 9 ms 5960 KB Output is correct
13 Correct 9 ms 5960 KB Output is correct
14 Correct 6 ms 5960 KB Output is correct
15 Correct 9 ms 5960 KB Output is correct
16 Correct 6 ms 5960 KB Output is correct
17 Correct 9 ms 5960 KB Output is correct
18 Correct 9 ms 5960 KB Output is correct
19 Correct 9 ms 5960 KB Output is correct
20 Correct 9 ms 5960 KB Output is correct
21 Correct 6 ms 5960 KB Output is correct
22 Correct 9 ms 5960 KB Output is correct
23 Correct 9 ms 5960 KB Output is correct
24 Correct 9 ms 5960 KB Output is correct
25 Correct 6 ms 5960 KB Output is correct
26 Correct 9 ms 5960 KB Output is correct
27 Correct 9 ms 5960 KB Output is correct
28 Correct 9 ms 5960 KB Output is correct
29 Correct 6 ms 5960 KB Output is correct
30 Correct 9 ms 5960 KB Output is correct
31 Correct 9 ms 5960 KB Output is correct
32 Correct 9 ms 5960 KB Output is correct
33 Correct 9 ms 5960 KB Output is correct
34 Correct 9 ms 5960 KB Output is correct
35 Correct 13 ms 5960 KB Output is correct
36 Correct 13 ms 5960 KB Output is correct
37 Correct 19 ms 5960 KB Output is correct
38 Correct 23 ms 5960 KB Output is correct
39 Correct 23 ms 5960 KB Output is correct
40 Correct 23 ms 5960 KB Output is correct
41 Correct 19 ms 5960 KB Output is correct
42 Correct 23 ms 5960 KB Output is correct
43 Correct 9 ms 5960 KB Output is correct
44 Correct 13 ms 5960 KB Output is correct
45 Correct 9 ms 5960 KB Output is correct
46 Correct 13 ms 5960 KB Output is correct
47 Correct 13 ms 5960 KB Output is correct
48 Correct 13 ms 5960 KB Output is correct
49 Correct 13 ms 5960 KB Output is correct
50 Correct 9 ms 5960 KB Output is correct
51 Correct 13 ms 5960 KB Output is correct
52 Correct 706 ms 5960 KB Output is correct
53 Execution timed out 1000 ms 5960 KB Execution timed out
54 Halted 0 ms 0 KB -