#include using namespace std; #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define print(var) std::cout<<#var<<"="<<(var)< #define vvi vector #define vvvi vector #define ll long long #define vll vector #define vvll vector #define vvvll vector #define vmi vector #define vvmi vector #define vvvmi vector #define vs vector #define pii pair #define vpii vector> #define bit(x,i)(((x)>>(i))&1) #define inf (1<<30) #define INF (1ll<<60) template inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); } template inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); } inline double get_time() { using namespace std::chrono; return duration_cast(system_clock::now().time_since_epoch()).count(); } unsigned long xor128(void){ static unsigned long x=123456789,y=362436069,z=521288629,w=88675123; unsigned long t; t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) ); } long long randInt(long long a,long long b){return a+xor128()%(b-a+1);} double randDouble(double a,double b){return a+(b-a)*xor128()/(double)ULONG_MAX;} double start_time; int n,m; vector c(20),l(20); vector> a(20),b(20); bool is_valid(int x,int y){ return 0<=x && x> A; Bombplan(){}; Bombplan(vector> AA):A(AA){} }; struct State{ vector> A; int center_shop_x; int center_shop_y; vector bomb; int bomb_sum=0; vector> hist; int building = 0; int shop = 0; ll cost=0; int nowx=0,nowy=0; State(){} State(vector> AA):A(AA){ bomb.resize(m); int min_center_dist = inf; for(int i=0;i=0 && i=0 && i=(double)INF){ for(int i=0;i> A; void IN(){ cin.tie(nullptr); ios::sync_with_stdio(false); cin>>n>>m; A.resize(n); for(int i=0;i>A[i][j]; } } for(int i=0;i>c[i]>>l[i]; for(int j=0;j>tmpa>>tmpb; a[i].emplace_back(tmpa); b[i].emplace_back(tmpb); } } } void solve(){ State state(A); while(state.building>0){ state.one_step(); cerr<