Submission #3791009


Source Code Expand

using namespace std ;
#include <bits/stdc++.h> // #7th-Polygon
#define TASKNAME "PHIDIAS"
inline int Minimize(int& A , int B) { return A = min(A , B) ; }

const int N = 600 ;

int dp[N + 7][N + 7] ;

int GetDP(int width , int height)
{
    if (dp[width][height] != -1) return dp[width][height] ;
    dp[width][height] = width * height ;

    for (int k = 1 ; k <= (width >> 1) ; ++k) if (dp[width][height] != 0)
        Minimize(dp[width][height] , GetDP(k , height) + GetDP(width - k , height)) ;
    for (int k = 1 ; k <= (height >> 1) ; ++k) if (dp[width][height] != 0)
        Minimize(dp[width][height] , GetDP(width , k) + GetDP(width , height - k)) ;
    return dp[width][height] ;
}

int main()
{
    //freopen(TASKNAME".inp" , "r" , stdin) ;
    //freopen(TASKNAME".out" , "w" , stdout) ;
    ios::sync_with_stdio(false) ;
    cout.tie(nullptr) ;
    cin.tie(nullptr) ;

    int TestCase ;
    cin >> TestCase ;

    while (TestCase--)
    {
        int width , height , n ;
        cin >> width >> height >> n ;

        memset(dp , -1 , sizeof dp) ;
        for (int i = 1 ; i <= n ; ++i)
        {
            int curr_width , curr_height ;
            cin >> curr_width >> curr_height ;
            dp[curr_width][curr_height] = false ;
        }

        cout << GetDP(width , height) << "\n" ;
    }

    cerr << "Executed time: " << clock() << " ms\n" ;
    return 0 ;
}

Submission Info

Submission Time
Task 13 - Phidias
User nbphong
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1438 Byte
Status WA
Exec Time 1055 ms
Memory 1792 KB

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
TLE × 1
TLE × 1
TLE × 1
WA × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 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 WA 3 ms 1664 KB
02 WA 3 ms 1664 KB
03 WA 3 ms 1664 KB
04 WA 3 ms 1664 KB
05 WA 3 ms 1664 KB
06 WA 3 ms 1664 KB
07 WA 3 ms 1664 KB
08 WA 3 ms 1664 KB
09 WA 3 ms 1664 KB
10 WA 3 ms 1664 KB
11 WA 310 ms 1664 KB
12 TLE 1055 ms 1792 KB
13 TLE 1055 ms 1792 KB
14 TLE 1055 ms 1792 KB
15 WA 498 ms 1792 KB
16 TLE 1055 ms 1664 KB
17 TLE 1055 ms 1792 KB
18 TLE 1055 ms 1792 KB
19 TLE 1055 ms 1792 KB
20 TLE 1055 ms 1792 KB