Submission #330304
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:14:48+0900
Task
13 - Phidias
User
ykaya
Language
C++ (G++ 4.6.4)
Score
0
Code Size
730 Byte
Status
WA
Exec Time
360 ms
Memory
2456 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
36 ms
2360 KB
02
WA
31 ms
2360 KB
03
WA
30 ms
2340 KB
04
WA
30 ms
2364 KB
05
WA
30 ms
2360 KB
06
WA
30 ms
2288 KB
07
WA
30 ms
2328 KB
08
WA
30 ms
2364 KB
09
WA
30 ms
2360 KB
10
WA
28 ms
2360 KB
11
WA
41 ms
2456 KB
12
WA
158 ms
2356 KB
13
WA
258 ms
2360 KB
14
WA
233 ms
2360 KB
15
WA
283 ms
2360 KB
16
WA
144 ms
2452 KB
17
WA
343 ms
2356 KB
18
WA
258 ms
2456 KB
19
WA
234 ms
2360 KB
20
WA
360 ms
2308 KB