Submission #87747
Source Code Expand
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
int a[205],b[205];
int dp[605][605];
int n,x,y;
void oku(){
int i;
scanf("%d %d %d",&x,&y,&n);
for(i=1;i<=n;i++)
scanf("%d %d",&a[i],&b[i]);
}
void coz(){
int i,j,k;
for(i=1;i<=x;i++)
for(j=1;j<=y;j++){
dp[i][j]=i*j;
for(k=1;k<=n;k++)
if(a[k]<=i && b[k]<=j)
dp[i][j]=min(dp[i][j],min(dp[a[k]][j-b[k]]+dp[i-a[k]][j],dp[i][j-b[k]]+dp[i-a[k]][b[k]]));
}
printf("%d\n",dp[x][y]);
}
int main(){
oku();
coz();
return 0;
}
Submission Info
Submission Time
2013-07-06 16:53:23+0900
Task
13 - Phidias
User
halilozanakgul
Language
C++ (GCC 4.4.7)
Score
100
Code Size
569 Byte
Status
AC
Exec Time
301 ms
Memory
2104 KB
Compile Error
./Main.cpp: In function ‘void oku()’:
./Main.cpp:11: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
./Main.cpp:13: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_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
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 5
5 / 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
AC
21 ms
784 KB
02
AC
21 ms
780 KB
03
AC
19 ms
780 KB
04
AC
22 ms
780 KB
05
AC
20 ms
780 KB
06
AC
20 ms
772 KB
07
AC
21 ms
776 KB
08
AC
20 ms
788 KB
09
AC
21 ms
776 KB
10
AC
22 ms
784 KB
11
AC
27 ms
1332 KB
12
AC
106 ms
1596 KB
13
AC
167 ms
1604 KB
14
AC
174 ms
1728 KB
15
AC
186 ms
1836 KB
16
AC
104 ms
1856 KB
17
AC
262 ms
1848 KB
18
AC
206 ms
2104 KB
19
AC
177 ms
1716 KB
20
AC
301 ms
2064 KB