Submission #330284
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:27:57+0900
Task
13 - Phidias
User
Kerem
Language
C++ (G++ 4.6.4)
Score
0
Code Size
722 Byte
Status
WA
Exec Time
498 ms
Memory
4772 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
31 ms
4652 KB
02
WA
32 ms
4596 KB
03
WA
30 ms
4644 KB
04
WA
30 ms
4772 KB
05
WA
31 ms
4636 KB
06
WA
30 ms
4648 KB
07
WA
30 ms
4636 KB
08
WA
32 ms
4708 KB
09
WA
30 ms
4648 KB
10
WA
33 ms
4640 KB
11
WA
46 ms
4636 KB
12
WA
203 ms
4644 KB
13
WA
327 ms
4580 KB
14
WA
323 ms
4644 KB
15
WA
376 ms
4708 KB
16
WA
190 ms
4648 KB
17
WA
492 ms
4504 KB
18
WA
365 ms
4648 KB
19
WA
322 ms
4704 KB
20
WA
498 ms
4652 KB