1 条题解

  • 0
    @ 2024-12-24 10:06:03

    C++ :

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <math.h>
    #include <algorithm>
    #include <map>
    #include <queue>
    #include <stack>
    #include <iostream>
    using namespace std;
    int Map[1001][1001];
    int main ()
    {
    	int n, m, i, j, k, len, c;
    	int a, b, h, x, y, max, max2, ii, jj, jjj;
    	
    	while(scanf("%d%d%d",&n,&m,&c) != EOF)
    	{
    		memset(Map,0,sizeof(Map));
    		max2 = -1;
    		for(k = 0 ; k < c ; k ++)
    		{
    			scanf("%d%d%d%d%d",&a,&b,&h,&x,&y);
    			max = -1;
    			for(i = x + 1; i <= x + a ; i ++)
    			{
    				for(j = y + 1; j <= y + b ; j ++)
    				{
    					if(Map[i][j] > max)
    					{
    						max = Map[i][j];
    						ii = i;
    						jj = j;
    					}
    					else
    						Map[i][j] = max + h;
    				}
    			}
    
    			for(i = x + 1 ; i <= ii ; i ++)
    			{
    				if(i == ii)
    					jjj = jj;
    				else
    					jjj = y + b;
    				for(j = y + 1 ; j <= jjj ; j ++)
    				{
    					Map[i][j] = max + h;
    				}
    			}
    			if(max + h > max2)
    					max2 = max + h;
    		}
    
    		printf("%d\n",max2);
    	}
    	return 0;
    }
    
    • 1

    信息

    ID
    1844
    时间
    11000ms
    内存
    130MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者