Submission #163674
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);
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
int a,b;
scanf("%d %d",&a,&b);
dp[a][b]=-1;
}
for(int i=1;i<=w;i++)
{
for(int j=1;j<=h;j++)
{
if(dp[i][j]!=-1)
{
dp[i][j]=i*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]);
}
}
else dp[i][j]=0;
}
}
printf("%d\n",dp[w][h]);
return 0;
}
Submission Info
Submission Time
2014-04-22 23:18:09+0900
Task
13 - Phidias
User
yutaka1999
Language
C++ (G++ 4.6.4)
Score
100
Code Size
670 Byte
Status
AC
Exec Time
392 ms
Memory
2092 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:16:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:20: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
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
796 KB
02
AC
23 ms
664 KB
03
AC
20 ms
792 KB
04
AC
23 ms
800 KB
05
AC
22 ms
796 KB
06
AC
21 ms
800 KB
07
AC
22 ms
696 KB
08
AC
20 ms
796 KB
09
AC
21 ms
792 KB
10
AC
20 ms
676 KB
11
AC
49 ms
1316 KB
12
AC
162 ms
1576 KB
13
AC
196 ms
1580 KB
14
AC
222 ms
1752 KB
15
AC
213 ms
1704 KB
16
AC
94 ms
1832 KB
17
AC
310 ms
1832 KB
18
AC
298 ms
2092 KB
19
AC
232 ms
1712 KB
20
AC
392 ms
2092 KB