Submission #1811501


Source Code Expand

{$mode objfpc}
{$COPERATORS ON}
uses math;
const fi=''; fo='';
type Titems=record w,h:longint; end;
var fin,fout:Text;
    n,R,C,nTest:longint;
    a:array[1..200+3] of Titems;
    f:array[0..600+7,0..600+7] of longint;
procedure doc;
    var i:longint;
    begin
    read(fin,C,R);
    read(fin,n);
    fillchar(F,sizeof(F),255);
        for i:=1 to n do
            begin
            read(fin,a[i].w,a[i].h);
            f[a[i].h,a[i].w]:=0;
            end;
    end;
function DP(row,col:longint):longint;
    var Res,i:longint;
    begin
    if F[Row,Col]<>-1 then exit(f[Row,Col]);
    Res:=Row*Col;
        for i:=1 to Row-1 do
            Res:=min(Res,DP(i,Col)+DP(Row-i,Col));
        for i:=1 to Col-1 do
            Res:=min(Res,DP(Row,i)+DP(Row,Col-i));
    F[Row,Col]:=Res;
    Exit(Res);
    end;
procedure Solve;
    begin
        writeln(fout,DP(R,C));
    end;
begin
    assign(fin,fi);
    assign(fout,fo);
    reset(fin);rewrite(fout);
        //readln(fin,nTest);
       // repeat
            Doc;
            Solve;
        //dec(nTest);
        //until nTest=0;
    close(fin);close(fout);
end.

Submission Info

Submission Time
Task 13 - Phidias
User ndhp2000
Language Pascal (FPC 2.6.2)
Score 85
Code Size 1164 Byte
Status TLE
Exec Time 1055 ms
Memory 1792 KB

Compile Error

/usr/bin/ld.bfd: warning: ./link.res contains output sections; did you forget -T?

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 0 / 5 0 / 5 5 / 5 0 / 5
Status
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
TLE × 1
TLE × 1
AC × 1
TLE × 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 AC 1 ms 1664 KB
02 AC 1 ms 1664 KB
03 AC 1 ms 1664 KB
04 AC 1 ms 1664 KB
05 AC 1 ms 1664 KB
06 AC 1 ms 1664 KB
07 AC 1 ms 1664 KB
08 AC 1 ms 1664 KB
09 AC 1 ms 1664 KB
10 AC 1 ms 1664 KB
11 AC 115 ms 1664 KB
12 AC 678 ms 1664 KB
13 AC 828 ms 1792 KB
14 AC 960 ms 1664 KB
15 AC 911 ms 1664 KB
16 AC 312 ms 1664 KB
17 TLE 1055 ms 1664 KB
18 TLE 1055 ms 1664 KB
19 AC 966 ms 1664 KB
20 TLE 1055 ms 1664 KB