Submission #330294


Source Code Expand

#include<bits/stdc++.h>

using namespace std;

#define st first
#define nd second

int n;

pair<int,int> A[205];

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));

   return 0;
}

Submission Info

Submission Time
Task 13 - Phidias
User berasogut
Language C++ (G++ 4.6.4)
Score 0
Code Size 746 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
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
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 2216 KB
02 WA 25 ms 2212 KB
03 WA 26 ms 2336 KB
04 WA 26 ms 2212 KB
05 WA 26 ms 2212 KB
06 WA 27 ms 2208 KB
07 WA 27 ms 2208 KB
08 WA 27 ms 2212 KB
09 WA 27 ms 2212 KB
10 WA 26 ms 2252 KB
11 WA 38 ms 2212 KB
12 WA 152 ms 2344 KB
13 WA 248 ms 2208 KB
14 WA 236 ms 2212 KB
15 WA 293 ms 2220 KB
16 WA 145 ms 2208 KB
17 WA 352 ms 2212 KB
18 WA 264 ms 2208 KB
19 WA 239 ms 2208 KB
20 WA 362 ms 2216 KB