Submission #330288
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
int n,m,j,k,i,l;
int A[1000][3];
int dp[1000][1000];
int f(int x,int y){
int i;
if(dp[x][y] != -1)
return dp[x][y];
dp[x][y] = 0;
if(!x || !y)
return dp[x][y];
for(i=1 ; i<=k ; i++)
if(A[i][0] > x || A[i][1] > y)
continue;
else
dp[x][y] = max(dp[x][y],max(f(x-A[i][0],A[i][1]) + f(x,y-A[i][1]) , f(x-A[i][0],y) + f(A[i][0],y-A[i][1]) ) + A[i][0]*A[i][1]);
return dp[x][y];
}
int main(){
memset(dp,-1,sizeof dp);
scanf("%d %d %d",&n,&m,&k);
for(i=1 ; i<=k ; i++)
scanf("%d %d",&A[i][0],&A[i][1]);
printf("%d",n*m - f(n,m));
return 0;
}
Submission Info
Submission Time
2015-02-02 21:36:13+0900
Task
13 - Phidias
User
Kerem
Language
C++ (G++ 4.6.4)
Score
0
Code Size
722 Byte
Status
WA
Exec Time
407 ms
Memory
4708 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:36:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:39:39: 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
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 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
WA
33 ms
4644 KB
02
WA
34 ms
4652 KB
03
WA
34 ms
4644 KB
04
WA
34 ms
4636 KB
05
WA
34 ms
4648 KB
06
WA
33 ms
4644 KB
07
WA
34 ms
4652 KB
08
WA
34 ms
4648 KB
09
WA
34 ms
4640 KB
10
WA
32 ms
4644 KB
11
WA
45 ms
4636 KB
12
WA
163 ms
4644 KB
13
WA
255 ms
4640 KB
14
WA
251 ms
4640 KB
15
WA
289 ms
4640 KB
16
WA
156 ms
4640 KB
17
WA
361 ms
4640 KB
18
WA
284 ms
4632 KB
19
WA
271 ms
4584 KB
20
WA
407 ms
4708 KB