Submission #330300


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

Submission Info

Submission Time
Task 13 - Phidias
User berasogut
Language C++ (G++ 4.6.4)
Score 0
Code Size 733 Byte
Status WA
Exec Time 365 ms
Memory 2340 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 26 ms 2208 KB
03 WA 25 ms 2212 KB
04 WA 26 ms 2336 KB
05 WA 27 ms 2212 KB
06 WA 27 ms 2212 KB
07 WA 27 ms 2208 KB
08 WA 28 ms 2204 KB
09 WA 26 ms 2152 KB
10 WA 26 ms 2216 KB
11 WA 39 ms 2332 KB
12 WA 154 ms 2212 KB
13 WA 251 ms 2340 KB
14 WA 235 ms 2204 KB
15 WA 287 ms 2148 KB
16 WA 148 ms 2212 KB
17 WA 349 ms 2212 KB
18 WA 261 ms 2340 KB
19 WA 236 ms 2220 KB
20 WA 365 ms 2204 KB