#include #include using namespace std; struct enemy_t { int x, y, hp, f; }; vector ene; vector > ene_h, ene_v; int main(void) { int i, j, n, k; int x, y, w, h, d; int s, e, ans; while(scanf("%d%d", &n, &k)==2) { ene_h.clear(); ene_v.clear(); ene_h.resize(1001); ene_v.resize(1001); ene.resize(n); for(i=0;if=i; } } s=max(y, -500); e=min(y+h, 500); for(j=s;j<=e;j++) { for(auto t: ene_v[j+500]) { if(t->f!=i) continue; t->hp-=d; } } } ans=0; for(i=0;i0) ans+=ene[i].hp; } /* for(auto t: ene) printf("%d ", t.hp); printf("\n"); */ printf("%d\n", ans); } return 0; }