Submission #263096

# Submission time Handle Problem Language Result Execution time Memory
263096 2020-08-13T13:01:14 Z ElyesChaabouni Pyramid Base (IOI08_pyramid_base) C++14
Compilation error
0 ms 0 KB
/*#pragma GCC optimize("O3")*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
//#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000000
#define PI 3.14159265358979323846
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n, m, b, p;
	cin >> m >> n >> b >> p;
	int l[n+1][m+1], d[n+1][m+1], dp[n+1][m+1];
	for(int i = 0; i <= n; i++)
	{
		for(int j = 0; j <= m; j++)
		{
				dp[i][j]=0;
				d[i][j]=1;
				l[i][j]=1;
		}
	}
	for(int i = 0; i < p; i++)
	{
		int x1, x2, y1, y2, pr;
		cin >> y1 >> x1 >> y2 >> x2 >> pr;
		for(int x = x1; x <= x2; x++)
		{
			for(int y = y1; y <= y2; y++)
			{
				l[x][y]=0;
				d[x][y]=0;
			}
		}
	}
	for(int i = 0; i <= m; i++)
		for(int j = n-1; j >= 0; j--)
			if(l[j][i])
				l[j][i]+=l[j+1][i];
	for(int i = 0; i <= n; i++)
		for(int j = m-1; j >= 0; j--)
			if(d[i][j])
				d[i][j]+=d[i][j+1];
	int ans=0;
	for(int i = m; i >= 0; i--)
	{
		for(int j = n; j >= 0; j--)
		{
			if(l[j][i] || d[j][i])
			{
				int dp[j][i]=min(d[j][i], l[j][i]);
				if(i+1 <= n && j+1 <= n)
				{
					dp[j][i]=min(d[j][i], dp[j+1][i+1]+1);
					ans=max(ans, dp[j][i]);
				}
			}
		}
	}
	cout << ans << '\n';
}
//size

Compilation message

pyramid_base.cpp: In function 'int main()':
pyramid_base.cpp:56:21: error: array must be initialized with a brace-enclosed initializer
   56 |     int dp[j][i]=min(d[j][i], l[j][i]);
      |                  ~~~^~~~~~~~~~~~~~~~~~