#include #include #include #include using namespace std; #define loop(i,a,b) for(int i=(a);i vi; typedef vector vvi; struct Enemy { int x,y,h; }; struct Magic { int x,y,w,h,d; }; int const GETA = 1100; int const SZ=GETA*2; int imos[SZ][SZ]; int main(){ int N,K; while(cin>>N>>K){ vector es(N); for(auto &e : es){ cin >> e.x >> e.y >> e.h; e.x+=GETA, e.y+=GETA; } vector ms(K); for(auto &m : ms){ cin>> m.x >> m.y >> m.w >> m.h >> m.d; m.x+=GETA, m.y+=GETA; m.w++; m.h++; } memset(imos,0,sizeof(imos)); for(auto &m: ms){ imos[m.y][m.x]+=m.d; imos[min(SZ, m.y+m.h)][m.x]-=m.d; imos[m.y][min(SZ, m.x+m.w)]-=m.d; imos[min(SZ, m.y+m.h)][min(SZ, m.x+m.w)]+=m.d; } for(int i=0;i