結果

問題 No.555 世界史のレポート
ユーザー mamekinmamekin
提出日時 2017-08-20 16:51:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,093 bytes
コンパイル時間 904 ms
コンパイル使用メモリ 104,044 KB
実行使用メモリ 65,932 KB
最終ジャッジ日時 2023-08-04 20:08:13
合計ジャッジ時間 4,491 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
65,620 KB
testcase_01 AC 95 ms
65,900 KB
testcase_02 AC 98 ms
65,744 KB
testcase_03 AC 99 ms
65,668 KB
testcase_04 AC 97 ms
65,740 KB
testcase_05 AC 100 ms
65,620 KB
testcase_06 AC 100 ms
65,676 KB
testcase_07 AC 103 ms
65,668 KB
testcase_08 AC 102 ms
65,616 KB
testcase_09 AC 102 ms
65,556 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

const int MAX = 4000;
const int INF = INT_MAX / 2;

int main()
{
    int n, c, v;
    cin >> n >> c >> v;

    vector<vector<int> > dp(MAX, vector<int>(MAX, INF));
    dp[1][0] = 0;
    for(int i=0; i<MAX; ++i){
        for(int j=0; j<=i; ++j){
            dp[i][i] = min(dp[i][i], dp[i][j] + c);
            if(i + j < MAX)
                dp[i+j][j] = min(dp[i+j][j], dp[i][j] + v);
        }
    }

    int ans = INF;
    for(int i=0; i<=min(n,MAX-1); ++i){
        for(int j=1; j<=i; ++j){
            int len = n - i;
            ans = min(ans, dp[i][j] + (len + j - 1) / j * v);
        }
    }
    cout << ans << endl;

    return 0;
}
0