萌新RE求教
查看原帖
萌新RE求教
402190
小小方糖楼主2020/10/8 12:47

#3 #4 RE 求大佬帮我看一下

#include<bits/stdc++.h>
using namespace std;

int main(){
	int n, m, x, y, cnt[2001][2001] = {0};
	char mp[2001][2001], num = '1';
	cin >> x >> y;
	// 标记未轰炸
	for(int i = 1; i <= 2001; i++)
		for(int j = 1; j <= 2001; j++) mp[i][j] = '.';
	// 设置轰炸区域
	for(int i = 1; i <= x; i++){
		int a, b, a2, b2;
		cin >> a >> b >> a2 >> b2;
		for(int j = a; j <= a2; j++)
			for(int k = b; k <= b2; k++){
				mp[j][k] = num;
				cnt[j][k]++;
			}
		num++;
	} 
	// 询问轰炸点
	for(int i = 1; i <= y; i++){
		int a, b;
		cin >> a >> b;
		if(mp[a][b] == '.') cout << "NO" <<endl;
		else cout << "YES" << ' ' << cnt[a][b] << ' ' << (int)(mp[a][b] - '0') <<endl;
	}	
	

	return 0;
}
2020/10/8 12:47
加载中...