Submission #330283
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]);
cout << n*m - f(n,m);
return 0;
}
Submission Info
Submission Time
2015-02-02 21:23:43+0900
Task
13 - Phidias
User
Kerem
Language
C++ (G++ 4.6.4)
Score
0
Code Size
717 Byte
Status
WA
Exec Time
407 ms
Memory
4936 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
43 ms
4836 KB
02
WA
34 ms
4888 KB
03
WA
36 ms
4788 KB
04
WA
36 ms
4796 KB
05
WA
33 ms
4792 KB
06
WA
34 ms
4792 KB
07
WA
34 ms
4788 KB
08
WA
32 ms
4936 KB
09
WA
35 ms
4844 KB
10
WA
35 ms
4832 KB
11
WA
47 ms
4792 KB
12
WA
164 ms
4796 KB
13
WA
259 ms
4792 KB
14
WA
254 ms
4792 KB
15
WA
291 ms
4788 KB
16
WA
154 ms
4796 KB
17
WA
365 ms
4796 KB
18
WA
280 ms
4844 KB
19
WA
254 ms
4796 KB
20
WA
407 ms
4796 KB