func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e4 + 10;   const int P = 1048576 + 10;   const int Y = 30;   int vis[N];   int cnt;   int book[N];   int a[N];   int n;   int m;   int k;   int addis[Y][Y];   int dis[N];   int dp[P];   queue<int> q;   inline void bfs(int s) {     for (int i = 1; i <= n + 1; i++) dis[i] = 0x3f3f3f3f;     dis[s] = 0;     int nw;     int i = 1;     for (q.push(s); !q.empty();)       for (nw = q.front(), q.pop(), i = 1; i <= m; i++) {         int v1 = nw + a[i];         if (v1 <= n + 1 && dis[v1] == 0x3f3f3f3f)           dis[v1] = dis[nw] + 1, q.push(v1);         int v2 = nw - a[i];         if (v2 >= 1 && dis[v2] == 0x3f3f3f3f) dis[v2] = dis[nw] + 1, q.push(v2);       }     for (int i = 1; i <= n + 1; i++)       if (vis[i] != -1) addis[vis[s]][vis[i]] = dis[i];   }   int main() {     scanf( %d%d%d , &n, &k, &m);     for (int i = 1, t; i <= k; i++) {       scanf( %d , &t);       book[t] = 1;     }     for (int i = 1; i <= m; i++) scanf( %d , &a[i]);     for (int i = n + 1; i >= 1; i--) book[i] ^= book[i - 1];     cnt = -1;     for (int i = 1; i <= n + 1; i++) vis[i] = -1;     for (int i = 1; i <= n + 1; i++)       if (book[i]) vis[i] = ++cnt;     for (int i = 1; i <= n + 1; i++)       if (book[i]) bfs(i);     for (int i = 1; i < (1 << (cnt + 1)); i++) dp[i] = 0x3f3f3f3f;     for (int i = 0; i < (1 << (cnt + 1)); i++) {       if (dp[i] == 0x3f3f3f3f) continue;       for (int j = 0; j <= cnt; j++) {         if ((i >> j) & 1) continue;         for (int k = j + 1; k <= cnt; k++)           if (((i >> k) & 1) == 0)             dp[i + (1 << j) + (1 << k)] =                 min(dp[i + (1 << j) + (1 << k)], dp[i] + addis[j][k]);       }     }     int ans = dp[(1 << (cnt + 1)) - 1];     printf( %d , (ans == 0x3f3f3f3f) ? -1 : ans);     return 0;   }   