結果

問題 No.398 ハーフパイプ(2)
ユーザー りあんりあん
提出日時 2016-07-14 16:29:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 774 ms / 2,000 ms
コード長 937 bytes
コンパイル時間 1,363 ms
コンパイル使用メモリ 164,168 KB
実行使用メモリ 191,964 KB
最終ジャッジ日時 2023-09-09 21:58:14
合計ジャッジ時間 14,223 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 353 ms
161,732 KB
testcase_01 AC 774 ms
190,108 KB
testcase_02 AC 685 ms
185,960 KB
testcase_03 AC 691 ms
186,356 KB
testcase_04 AC 690 ms
186,204 KB
testcase_05 AC 752 ms
189,672 KB
testcase_06 AC 501 ms
173,968 KB
testcase_07 AC 599 ms
180,892 KB
testcase_08 AC 748 ms
191,964 KB
testcase_09 AC 742 ms
189,364 KB
testcase_10 AC 736 ms
189,452 KB
testcase_11 AC 742 ms
189,844 KB
testcase_12 AC 730 ms
188,740 KB
testcase_13 AC 729 ms
188,620 KB
testcase_14 AC 727 ms
188,692 KB
testcase_15 AC 749 ms
190,048 KB
testcase_16 AC 731 ms
188,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

long long dp[6][101][101][601];
int main()
{
    double x;
    cin >> x;
    int sum = (int)(x * 4 + 1e-9);
    long long ans = 0;
    int lim = sum + 200;
    for (int i = 0; i < 101; ++i) {
        dp[0][i][i][i] = 1;
    }
    for (int i = 1; i < 6; i++) {
        for (int j = 0; j < 101; j++) {
            for (int k = j; k < 101; k++) {
                for (int l = j * i; l <= lim && l <= k * i; ++l) {
//                    if (dp[i - 1][j][k][l] == 0) continue;
                    
                    for (int m = 0; m < 101 && l + m <= lim; ++m) {
                        dp[i][min(j, m)][max(k, m)][l + m] += dp[i - 1][j][k][l];
                    }
                }
            }
        }
    }
    for (int i = 0; i < 101; ++i) {
        for (int j = i; j < 101; ++j) {
            ans += dp[5][i][j][sum + i + j];
        }
    }
    cout << ans << "\n";
    return 0;
}
0