Submission #699812

# Submission time Handle Problem Language Result Execution time Memory
699812 2023-02-18T04:39:59 Z Abrar_Al_Samit Bali Sculptures (APIO15_sculpture) C++17
71 / 100
313 ms 460 KB
#include<bits/stdc++.h>
using namespace std;

const int nax = 101;
int n, a, b;

long long ans;
int curBit;
int dp[nax][nax];
int tree[nax];

bool good(long long S) {
  if(S>>curBit&1) return false;
  for(int j=curBit+1; j<60; ++j) {
    if((S>>j&1) && (~ans>>j&1)) return false;
  }
  return true;
}
int solve(int i, int j) {
  if(i>n) return j>=a && j<=b;
  int &ret = dp[i][j];
  if(ret!=-1) return ret;
  ret = 0;

  long long S = 0;
  for(int k=i; k<=n; ++k) {
    S += tree[k];
    if(good(S)) ret |= solve(k+1, j+1);
  }
  return ret;
}
void PlayGround() {
  cin>>n>>a>>b;
  for(int i=1; i<=n; ++i) {
    cin>>tree[i];
  }

  for(int i=59; i>=0; --i) {
    curBit = i;
    memset(dp, -1, sizeof dp);
    if(!solve(1, 0)) ans |= 1LL<<i;
  }
  cout<<ans<<'\n';

  // cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  PlayGround();
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 4 ms 356 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 4 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 3 ms 360 KB Output is correct
21 Correct 3 ms 340 KB Output is correct
22 Correct 3 ms 340 KB Output is correct
23 Correct 3 ms 340 KB Output is correct
24 Correct 3 ms 340 KB Output is correct
25 Correct 3 ms 340 KB Output is correct
26 Correct 5 ms 340 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 1 ms 324 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 3 ms 324 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 3 ms 340 KB Output is correct
36 Correct 3 ms 360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 4 ms 356 KB Output is correct
9 Correct 5 ms 340 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 3 ms 340 KB Output is correct
22 Correct 4 ms 340 KB Output is correct
23 Correct 4 ms 340 KB Output is correct
24 Correct 3 ms 340 KB Output is correct
25 Correct 5 ms 352 KB Output is correct
26 Correct 3 ms 340 KB Output is correct
27 Correct 3 ms 340 KB Output is correct
28 Correct 5 ms 340 KB Output is correct
29 Correct 20 ms 356 KB Output is correct
30 Correct 22 ms 360 KB Output is correct
31 Correct 37 ms 340 KB Output is correct
32 Correct 36 ms 340 KB Output is correct
33 Correct 39 ms 340 KB Output is correct
34 Correct 37 ms 340 KB Output is correct
35 Correct 40 ms 340 KB Output is correct
36 Correct 37 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 3 ms 352 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
14 Correct 3 ms 340 KB Output is correct
15 Correct 5 ms 340 KB Output is correct
16 Correct 18 ms 340 KB Output is correct
17 Correct 22 ms 356 KB Output is correct
18 Correct 37 ms 340 KB Output is correct
19 Correct 37 ms 340 KB Output is correct
20 Correct 40 ms 340 KB Output is correct
21 Correct 45 ms 340 KB Output is correct
22 Correct 37 ms 340 KB Output is correct
23 Correct 40 ms 340 KB Output is correct
24 Correct 39 ms 356 KB Output is correct
25 Correct 78 ms 340 KB Output is correct
26 Correct 129 ms 340 KB Output is correct
27 Correct 212 ms 340 KB Output is correct
28 Correct 267 ms 460 KB Output is correct
29 Correct 255 ms 340 KB Output is correct
30 Correct 291 ms 340 KB Output is correct
31 Correct 264 ms 340 KB Output is correct
32 Correct 278 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 4 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 3 ms 340 KB Output is correct
22 Correct 4 ms 340 KB Output is correct
23 Correct 3 ms 340 KB Output is correct
24 Correct 3 ms 340 KB Output is correct
25 Correct 3 ms 340 KB Output is correct
26 Correct 4 ms 340 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 2 ms 324 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 1 ms 324 KB Output is correct
33 Correct 2 ms 328 KB Output is correct
34 Correct 2 ms 320 KB Output is correct
35 Correct 3 ms 324 KB Output is correct
36 Correct 3 ms 340 KB Output is correct
37 Correct 4 ms 340 KB Output is correct
38 Correct 6 ms 356 KB Output is correct
39 Correct 17 ms 360 KB Output is correct
40 Correct 23 ms 340 KB Output is correct
41 Correct 36 ms 340 KB Output is correct
42 Correct 36 ms 340 KB Output is correct
43 Correct 51 ms 340 KB Output is correct
44 Correct 37 ms 340 KB Output is correct
45 Correct 37 ms 336 KB Output is correct
46 Correct 37 ms 340 KB Output is correct
47 Correct 40 ms 340 KB Output is correct
48 Correct 84 ms 460 KB Output is correct
49 Correct 137 ms 344 KB Output is correct
50 Correct 206 ms 348 KB Output is correct
51 Correct 278 ms 352 KB Output is correct
52 Correct 257 ms 320 KB Output is correct
53 Correct 297 ms 344 KB Output is correct
54 Correct 263 ms 352 KB Output is correct
55 Correct 267 ms 344 KB Output is correct
56 Correct 13 ms 340 KB Output is correct
57 Correct 52 ms 340 KB Output is correct
58 Correct 81 ms 340 KB Output is correct
59 Correct 88 ms 344 KB Output is correct
60 Correct 76 ms 340 KB Output is correct
61 Correct 90 ms 344 KB Output is correct
62 Correct 111 ms 344 KB Output is correct
63 Correct 102 ms 340 KB Output is correct
64 Correct 241 ms 344 KB Output is correct
65 Correct 17 ms 340 KB Output is correct
66 Correct 28 ms 340 KB Output is correct
67 Correct 41 ms 340 KB Output is correct
68 Correct 71 ms 344 KB Output is correct
69 Correct 80 ms 340 KB Output is correct
70 Correct 77 ms 344 KB Output is correct
71 Correct 104 ms 432 KB Output is correct
72 Correct 114 ms 340 KB Output is correct
73 Correct 101 ms 340 KB Output is correct
74 Correct 104 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 6 ms 340 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 4 ms 340 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 3 ms 320 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 3 ms 324 KB Output is correct
23 Correct 4 ms 340 KB Output is correct
24 Correct 4 ms 340 KB Output is correct
25 Correct 6 ms 324 KB Output is correct
26 Correct 24 ms 340 KB Output is correct
27 Correct 25 ms 320 KB Output is correct
28 Correct 45 ms 340 KB Output is correct
29 Correct 36 ms 340 KB Output is correct
30 Correct 39 ms 340 KB Output is correct
31 Correct 43 ms 340 KB Output is correct
32 Correct 41 ms 372 KB Output is correct
33 Correct 39 ms 344 KB Output is correct
34 Correct 40 ms 340 KB Output is correct
35 Correct 78 ms 344 KB Output is correct
36 Correct 137 ms 344 KB Output is correct
37 Correct 218 ms 352 KB Output is correct
38 Correct 281 ms 340 KB Output is correct
39 Correct 281 ms 344 KB Output is correct
40 Correct 313 ms 340 KB Output is correct
41 Correct 289 ms 348 KB Output is correct
42 Correct 299 ms 340 KB Output is correct
43 Correct 13 ms 340 KB Output is correct
44 Correct 62 ms 344 KB Output is correct
45 Correct 72 ms 344 KB Output is correct
46 Correct 114 ms 348 KB Output is correct
47 Correct 91 ms 340 KB Output is correct
48 Correct 93 ms 340 KB Output is correct
49 Correct 113 ms 340 KB Output is correct
50 Correct 137 ms 344 KB Output is correct
51 Incorrect 94 ms 340 KB Output isn't correct
52 Halted 0 ms 0 KB -