Submission #330297
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
int n,m,j,k,i,l;
int A[1500][3];
int dp[1500][15000];
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 |
701 Byte |
Status |
MLE |
Exec Time |
592 ms |
Memory |
88808 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 |
MLE |
220 ms |
88804 KB |
02 |
MLE |
212 ms |
88760 KB |
03 |
MLE |
210 ms |
88764 KB |
04 |
MLE |
212 ms |
88764 KB |
05 |
MLE |
208 ms |
88760 KB |
06 |
MLE |
208 ms |
88760 KB |
07 |
MLE |
205 ms |
88764 KB |
08 |
MLE |
194 ms |
88760 KB |
09 |
MLE |
190 ms |
88764 KB |
10 |
MLE |
195 ms |
88764 KB |
11 |
MLE |
206 ms |
88760 KB |
12 |
MLE |
328 ms |
88760 KB |
13 |
MLE |
422 ms |
88796 KB |
14 |
MLE |
421 ms |
88764 KB |
15 |
MLE |
486 ms |
88764 KB |
16 |
MLE |
319 ms |
88760 KB |
17 |
MLE |
550 ms |
88760 KB |
18 |
MLE |
477 ms |
88760 KB |
19 |
MLE |
430 ms |
88808 KB |
20 |
MLE |
592 ms |
88760 KB |