Submission #401349

# Submission time Handle Problem Language Result Execution time Memory
401349 2021-05-09T23:00:30 Z Azimjon Bali Sculptures (APIO15_sculpture) C++17
21 / 100
4 ms 1100 KB
#include <bits/stdc++.h>
using namespace std;

int dp[105][2005];
int n, a, b;
int d[105];
int INF = 1000000000;

int main() {
  scanf("%d %d %d", &n, &a, &b);
  for (int i = 0; i < n; i++) {
    scanf("%d", &d[i]);
  }

  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= 2000; j++) {
      dp[i][j] = INF;
    }
  }

  dp[0][0] = 0;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= 2000; j++) {
      if (dp[i][j] < INF) {
        int cur_sum = 0;
        for (int k = i; k < n; k++) {
          cur_sum += d[k];
          dp[k + 1][j | cur_sum] = min(dp[k + 1][j | cur_sum], dp[i][j] + 1);
        }
      }
    }
  }
  for (int i = 0; i <= 2000; i++) {
    if (dp[n][i] <= b) {
      printf("%d\n", i);
      return 0;
    }
  }
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |   scanf("%d %d %d", &n, &a, &b);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |     scanf("%d", &d[i]);
      |     ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 428 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Incorrect 1 ms 304 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 1 ms 284 KB Output is correct
15 Incorrect 1 ms 332 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 428 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 428 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 1 ms 460 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 588 KB Output is correct
17 Correct 1 ms 588 KB Output is correct
18 Correct 1 ms 588 KB Output is correct
19 Correct 1 ms 588 KB Output is correct
20 Correct 1 ms 588 KB Output is correct
21 Correct 1 ms 588 KB Output is correct
22 Correct 1 ms 692 KB Output is correct
23 Correct 2 ms 692 KB Output is correct
24 Correct 1 ms 716 KB Output is correct
25 Correct 2 ms 716 KB Output is correct
26 Correct 2 ms 844 KB Output is correct
27 Correct 3 ms 940 KB Output is correct
28 Correct 3 ms 972 KB Output is correct
29 Correct 3 ms 1100 KB Output is correct
30 Correct 3 ms 972 KB Output is correct
31 Correct 4 ms 1072 KB Output is correct
32 Correct 4 ms 1100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 428 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 424 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Incorrect 1 ms 332 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 432 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Runtime error 1 ms 460 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -