Submission #330302
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
#define st first
#define nd second
int n;
pair<int,int> A[605];
int DP[605][605];
int f(int x,int y){
if(DP[x][y]!=-1)
return DP[x][y];
int bek=0,i,mn=INT_MAX;
for(i=1 ; i<=n ; i++)
if(A[i].st<=x and A[i].nd<=y){
bek=1;
mn=min( mn , min( f(A[i].st,y-A[i].nd) + f(x-A[i].st,y) , f(x-A[i].st,A[i].nd) + f(x,y-A[i].nd) ) );
}
if(bek)
return DP[x][y]=mn;
return DP[x][y]=x*y;
}
int main(){
memset(DP,-1,sizeof DP);
int w,h,i;
scanf("%d %d",&w,&h);
scanf("%d",&n);
for(i=1 ; i<=n ; i++)
scanf("%d %d",&A[i].st,&A[i].nd);
printf("%d",f(w,h));
}
Submission Info
Submission Time
2015-02-02 22:10:12+0900
Task
13 - Phidias
User
berasogut
Language
C++ (G++ 4.6.4)
Score
0
Code Size
730 Byte
Status
WA
Exec Time
362 ms
Memory
2344 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:39:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:41:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:44: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
27 ms
2336 KB
02
WA
27 ms
2332 KB
03
WA
26 ms
2336 KB
04
WA
26 ms
2208 KB
05
WA
26 ms
2212 KB
06
WA
26 ms
2208 KB
07
WA
26 ms
2212 KB
08
WA
29 ms
2116 KB
09
WA
26 ms
2340 KB
10
WA
26 ms
2212 KB
11
WA
38 ms
2212 KB
12
WA
171 ms
2232 KB
13
WA
251 ms
2208 KB
14
WA
237 ms
2224 KB
15
WA
287 ms
2336 KB
16
WA
145 ms
2216 KB
17
WA
347 ms
2212 KB
18
WA
268 ms
2344 KB
19
WA
234 ms
2216 KB
20
WA
362 ms
2212 KB