#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)); } 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; vector bomb; int bomb_sum=0; vector> hist; ll building = 0; ll shop = 0; ll cost=0; int nowx=0,nowy=0; State(){} State(vector> AA):A(AA){ bomb.resize(m); for(int i=0;i=0 && 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<