Submission #87716
Source Code Expand
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
#define minn(a,b) ((a<b) ? (a) : (b))
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:50:02+0900
Task
13 - Phidias
User
halilozanakgul
Language
C++ (GCC 4.4.7)
Score
100
Code Size
700 Byte
Status
AC
Exec Time
298 ms
Memory
2108 KB
Compile Error
./Main.cpp: In function ‘void oku()’:
./Main.cpp:12: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
./Main.cpp:14: 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
780 KB
02
AC
22 ms
788 KB
03
AC
20 ms
780 KB
04
AC
20 ms
780 KB
05
AC
20 ms
780 KB
06
AC
21 ms
784 KB
07
AC
20 ms
704 KB
08
AC
21 ms
780 KB
09
AC
21 ms
784 KB
10
AC
21 ms
788 KB
11
AC
28 ms
1344 KB
12
AC
104 ms
1592 KB
13
AC
167 ms
1596 KB
14
AC
173 ms
1720 KB
15
AC
184 ms
1828 KB
16
AC
104 ms
1860 KB
17
AC
259 ms
1852 KB
18
AC
207 ms
2108 KB
19
AC
173 ms
1732 KB
20
AC
298 ms
2104 KB