#include <cstdio>#include <cstring>#include <cmath>#include <iostream>#include <algorithm>#define MAXN 300#define MAXM 101000using namespace std;const double eps = 1e-9;int w, h, m;long long ma[MAXN][MAXN];struct que { int x1, x2, y1, y2, kind;} all[MAXM];int main() { while (scanf("%d %d", &w, &h) == 2) { for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) scanf("%lldn", ma[i] + j); int m; scanf("%d", &m); for (int i = 0; i < m; i++) scanf("%d %d %d %d %d", &all[i].x1, &all[i].y1, &all[i].x2, &all[i].y2, &all[i].kind); int x, y; long long ans = 0, hao = 1; scanf("%d %d", &x, &y); for (int i = m - 1; i >= 0; i--) { if (x >= all[i].x1 && x <= all[i].x2 && y >= all[i].y1 && y <= all[i].y2) { if (all[i].kind == 1) { hao *= -1; } else if (all[i].kind == 2) { ans += hao; } else if (all[i].kind == 3) { ans -= hao; } else if (all[i].kind == 4) { x = all[i].x1 + all[i].x2 - x; } else { y = all[i].y1 + all[i].y2 - y; } } } ans+=hao*ma[y][x]; cout<<ans<<endl; }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)