Submission #163673


Source Code Expand

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#define SIZE 605

using namespace std;

int dp[SIZE][SIZE];

int main()
{
	int w,h;
	scanf("%d %d",&w,&h);
	for(int i=1;i<=w;i++)
	{
		for(int j=1;j<=h;j++)
		{
			dp[i][j]=i*j;
		}
	}
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		dp[a][b]=0;
	}
	for(int i=1;i<=w;i++)
	{
		for(int j=1;j<=h;j++)
		{
			for(int k=1;k<j;k++)
			{
				dp[i][j]=min(dp[i][j],dp[i][k]+dp[i][j-k]);
			}
			for(int k=1;k<i;k++)
			{
				dp[i][j]=min(dp[i][j],dp[k][j]+dp[i-k][j]);
			}
		}
	}
	printf("%d\n",dp[w][h]);
	return 0;
}

Submission Info

Submission Time
Task 13 - Phidias
User yutaka1999
Language C++ (G++ 4.6.4)
Score 100
Code Size 673 Byte
Status AC
Exec Time 402 ms
Memory 2096 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:23:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:27:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

Judge Result

Set Name Set01 Set02 Set03 Set04 Set05 Set06 Set07 Set08 Set09 Set10 Set11 Set12 Set13 Set14 Set15 Set16 Set17 Set18 Set19 Set20
Score / Max Score 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5 5 / 5
Status
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
Set Name Test Cases
Set01 01
Set02 02
Set03 03
Set04 04
Set05 05
Set06 06
Set07 07
Set08 08
Set09 09
Set10 10
Set11 11
Set12 12
Set13 13
Set14 14
Set15 15
Set16 16
Set17 17
Set18 18
Set19 19
Set20 20
Case Name Status Exec Time Memory
01 AC 22 ms 780 KB
02 AC 19 ms 792 KB
03 AC 21 ms 792 KB
04 AC 21 ms 800 KB
05 AC 21 ms 800 KB
06 AC 22 ms 788 KB
07 AC 21 ms 800 KB
08 AC 24 ms 672 KB
09 AC 20 ms 796 KB
10 AC 20 ms 796 KB
11 AC 48 ms 1320 KB
12 AC 164 ms 1688 KB
13 AC 196 ms 1700 KB
14 AC 230 ms 1820 KB
15 AC 216 ms 1704 KB
16 AC 93 ms 1812 KB
17 AC 318 ms 1952 KB
18 AC 304 ms 2096 KB
19 AC 228 ms 1820 KB
20 AC 402 ms 2088 KB