#include #define LL long long #define PII pair #define mp make_pair #define fi first #define se second using namespace std; const int maxn = 510; int food[maxn][maxn]; int need[10]; int n,x,y; vectorQ; void work(){ int times = need[9] * 2; for (int i=1;i<=n;i++) for (int j=1;j<=n;j++){ // cout<<"("< n || dj > n) continue; if (abs(i-di) + abs(j-dj) > 3) continue; if (di == i && dj == j) continue; Q.push_back(-food[di][dj]); } sort(Q.begin(), Q.end()); // for (int i=0;i