pz12_gavrilov

This is a task for our favourite professor
git clone git://git.stellar-nexus.ru/pz12_gavrilov
Log | Files | Refs

knapsack.h (714B)


      1 #include <stdint.h>
      2 typedef uint64_t BitChunk;
      3 #define CHECK(arr, bit) ((arr)[((bit)/64)] &   (1ULL << ((bit)%64)))
      4 #define   SET(arr, bit) ((arr)[((bit)/64)] |=  (1ULL << ((bit)%64)))
      5 #define CLEAR(arr, bit) ((arr)[((bit)/64)] &= ~(1ULL << ((bit)%64)))
      6 
      7 int  knapsack_bell(unsigned int k,    unsigned int w,
      8                    unsigned int m[k], unsigned int c[k],
      9                    BitChunk out[k/64+1]);
     10 int knapsack_greed(unsigned int k,    unsigned int w,
     11                    unsigned int m[k], unsigned int c[k],
     12                    BitChunk out[k/64+1]);
     13 int  knapsack_full(unsigned int k,    unsigned int w,
     14                    unsigned int m[k], unsigned int c[k],
     15                    BitChunk out[k/64+1]);