Submission #330289
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);
cin >> n >> m >> k;
for(i=1 ; i<=k ; i++)
cin >> A[i][0] >> A[i][1];
cout << n*m - f(n,m);
return 0;
}
Submission Info
Submission Time |
|
Task |
13 - Phidias |
User |
Kerem |
Language |
C++ (G++ 4.6.4) |
Score |
0 |
Code Size |
702 Byte |
Status |
WA |
Exec Time |
424 ms |
Memory |
4652 KB |
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 |
4636 KB |
02 |
WA |
32 ms |
4596 KB |
03 |
WA |
32 ms |
4636 KB |
04 |
WA |
30 ms |
4640 KB |
05 |
WA |
32 ms |
4640 KB |
06 |
WA |
32 ms |
4644 KB |
07 |
WA |
32 ms |
4644 KB |
08 |
WA |
32 ms |
4636 KB |
09 |
WA |
32 ms |
4640 KB |
10 |
WA |
32 ms |
4644 KB |
11 |
WA |
44 ms |
4640 KB |
12 |
WA |
167 ms |
4640 KB |
13 |
WA |
261 ms |
4644 KB |
14 |
WA |
259 ms |
4644 KB |
15 |
WA |
299 ms |
4644 KB |
16 |
WA |
156 ms |
4652 KB |
17 |
WA |
378 ms |
4648 KB |
18 |
WA |
289 ms |
4648 KB |
19 |
WA |
260 ms |
4644 KB |
20 |
WA |
424 ms |
4628 KB |