IOI 2004

Submission #3791009

Source codeソースコード

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

Task問題 13 - Phidias
User nameユーザ名 nbphong
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1438 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Set01 0 / 5 01
Set02 0 / 5 02
Set03 0 / 5 03
Set04 0 / 5 04
Set05 0 / 5 05
Set06 0 / 5 06
Set07 0 / 5 07
Set08 0 / 5 08
Set09 0 / 5 09
Set10 0 / 5 10
Set11 0 / 5 11
Set12 0 / 5 12
Set13 0 / 5 13
Set14 0 / 5 14
Set15 0 / 5 15
Set16 0 / 5 16
Set17 0 / 5 17
Set18 0 / 5 18
Set19 0 / 5 19
Set20 0 / 5 20

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01 WA
02 WA
03 WA
04 WA
05 WA
06 WA
07 WA
08 WA
09 WA
10 WA
11 WA
12 TLE
13 TLE
14 TLE
15 WA
16 TLE
17 TLE
18 TLE
19 TLE
20 TLE