比赛 20161116 评测结果 AAAAAAAAAA
题目名称 删除他们! 最终得分 100
用户昵称 Fmuckss 运行时间 0.160 s
代码语言 C++ 内存使用 1.27 MiB
提交时间 2016-11-16 11:51:48
显示代码纯文本
#include <iostream>
#include <cstdio>
using namespace std;
const int maxn = 1e6 + 10;
 
bool dels[maxn];
int n, m, q;

void solve() {
	scanf("%d %d %d", &n, &m, &q);
	int x1, y1, x2, y2;
	
	int tar, ltop = m * n;
	for (int i = 1; i <= q; i++) {
		scanf("%d %d %d	%d", &x1, &y1, &x2, &y2);
		x1++, y1++, x2++, y2++;
		for (int j = x1; j <= x2; j++) {
			int lnow = m * (j - 1) + y1;
			for (int k = y1; k <= y2; k++) {
				dels[lnow] = true;
				lnow++;
			}
		}
		int tmp = 0;
		for (int j = 1; j <=ltop; j++)
			if (not dels[j]) dels[++tmp] = false;
		ltop = tmp;
	}
	
	printf("%d\n", ltop);
}

int main() {
	freopen("deleteit.in", "r", stdin);
	freopen("deleteit.out", "w", stdout);
	solve();
	return 0;
}