MLE 50分求助
查看原帖
MLE 50分求助
594405
Unaccepted_Error楼主2022/11/17 15:35
#include<bits/stdc++.h>
using namespace std;

const int MAXN = 10005;
int model[MAXN][MAXN];

//struct carpet{
//	int a;
//	int b;
//	int g;
//	int k;
//};

void draw(int id,int a,int b,int x,int y){//a,b  是左下角的xy坐标 
	for(int i = a;i <= a + x;i++){
//		printf("%d\n",__LINE__);
		for(int j = b;j <= b + y;j++){
//			printf("%d\n",__LINE__);
			model[i][j] = id;
		}
	}
	return ;
}

//int print(int xpos,int ypos){
//	if(model[xpos][ypos] == 0)
//		printf("-1");
//	else
//		printf("%d",model[xpos][ypos]);
//}

//carpet a[10005];

int main(){
	int n,xpos,ypos,ma,mb,mg,mk;
	scanf("%d",&n);
	for(int i = 1;i <= n;i++){
//		printf("%d i = %d n = %d\n",__LINE__,i,n);
//		scanf("%d%d%d%d",&a[i].a,&a[i].b,&a[i].g,&a[i].k);
		scanf("%d%d%d%d",&ma,&mb,&mg,&mk);
//		printf("%d i = %d n = %d\n",__LINE__,i,n);
//		draw(i,a[i].a,a[i].b,a[i].g,a[i].k);
		draw(i,ma,mb,mg,mk);
//		printf("%d i = %d n = %d\n",__LINE__,i,n);
	}
	scanf("%d%d",&xpos,&ypos);
//	printf("%d",print(xpos,ypos));
	if(model[xpos][ypos] == 0)
		printf("-1");
	else
		printf("%d",model[xpos][ypos]);
	return 0;
}
2022/11/17 15:35
加载中...