Submission #23116

# Submission time Handle Problem Language Result Execution time Memory
23116 2017-05-03T07:46:23 Z ngkan146 Bali Sculptures (APIO15_sculpture) C++
37 / 100
23 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 += (1<<bit);
   }
   cout << res;
}
# 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 9 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 9 ms 5960 KB Output is correct
7 Correct 9 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 9 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 6 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 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 9 ms 5960 KB Output is correct
27 Correct 6 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 Incorrect 9 ms 5960 KB Output isn't correct
31 Halted 0 ms 0 KB -
# 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 9 ms 5960 KB Output is correct
7 Correct 9 ms 5960 KB Output is correct
8 Correct 6 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 6 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 9 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 6 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 9 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 9 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 6 ms 5960 KB Output is correct
5 Correct 9 ms 5960 KB Output is correct
6 Correct 6 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 6 ms 5960 KB Output is correct
12 Correct 9 ms 5960 KB Output is correct
13 Correct 6 ms 5960 KB Output is correct
14 Correct 6 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 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 9 ms 5960 KB Output is correct
22 Correct 6 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 19 ms 5960 KB Output is correct
27 Correct 16 ms 5960 KB Output is correct
28 Correct 23 ms 5960 KB Output is correct
29 Correct 19 ms 5960 KB Output is correct
30 Correct 19 ms 5960 KB Output is correct
31 Correct 23 ms 5960 KB Output is correct
32 Correct 23 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 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 6 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 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 9 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 6 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 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 6 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 Incorrect 6 ms 5960 KB Output isn't correct
31 Halted 0 ms 0 KB -
# 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 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 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 6 ms 5960 KB Output is correct
16 Correct 9 ms 5960 KB Output is correct
17 Incorrect 9 ms 5960 KB Output isn't correct
18 Halted 0 ms 0 KB -