svcomp_knapsack_unsafe.c

loading
details
attribute value
description
owner Johannes Waldmann
uploaded 2017-08-17 03:45:16.0
disk size 621 Bytes
downloadable true
type
attribute value
name no_type
processor id 1
description this is the default benchmark type for rejected benchmarks and benchmarks that are not associated with a type.
owning community none
loading contents
extern int __VERIFIER_nondet_int(void);

void knapsack(int size[], int val[], int N, int cost[], int best[], int M)
{
    int i, j;
    for (j = 1; j <= N; j++) {
        for (i = 1; i <= M; i++) {
            if (i >= size[j]) {
                if (cost[i] < cost[i - size[j]] + val[j]) {
                    cost[i] = cost[i - size[j]] + val[j];
                    best[i] = j;
                }
            }
        }
    }
}

int main() {
  int *size;
  int *val;
  int N = __VERIFIER_nondet_int();
  int *cost;
  int *best;
  int M = __VERIFIER_nondet_int();
  knapsack(size, val, N, cost, best, M);
  return 0;
}
popout

content may be truncated. 'popout' for larger text window.

actions get anonymous link download benchmark