結果

問題 No.398 ハーフパイプ(2)
ユーザー りあんりあん
提出日時 2016-07-14 16:29:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 348 ms / 2,000 ms
コード長 935 bytes
コンパイル時間 1,783 ms
コンパイル使用メモリ 164,608 KB
実行使用メモリ 146,724 KB
最終ジャッジ日時 2023-09-09 21:53:53
合計ジャッジ時間 8,023 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
111,536 KB
testcase_01 AC 348 ms
146,532 KB
testcase_02 AC 317 ms
141,880 KB
testcase_03 AC 319 ms
142,200 KB
testcase_04 AC 317 ms
142,116 KB
testcase_05 AC 342 ms
146,056 KB
testcase_06 AC 205 ms
127,436 KB
testcase_07 AC 263 ms
135,680 KB
testcase_08 AC 342 ms
146,724 KB
testcase_09 AC 341 ms
145,764 KB
testcase_10 AC 341 ms
145,936 KB
testcase_11 AC 343 ms
146,108 KB
testcase_12 AC 337 ms
145,028 KB
testcase_13 AC 337 ms
145,184 KB
testcase_14 AC 338 ms
144,876 KB
testcase_15 AC 343 ms
146,420 KB
testcase_16 AC 340 ms
145,064 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