結果

問題 No.555 世界史のレポート
ユーザー parukiparuki
提出日時 2017-08-11 23:22:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,303 bytes
コンパイル時間 1,679 ms
コンパイル使用メモリ 167,504 KB
実行使用メモリ 814,336 KB
最終ジャッジ日時 2024-04-20 23:38:59
合計ジャッジ時間 3,131 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,948 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 3 ms
6,940 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 3 ms
6,940 KB
testcase_07 AC 4 ms
6,944 KB
testcase_08 AC 5 ms
6,948 KB
testcase_09 AC 5 ms
6,944 KB
testcase_10 MLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define rt return
using dbl = double;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

const int INF = INT_MAX / 3;

vi f[25001];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N, C, V;
    cin >> N >> C >> V;

    int R = min(N, 25000);
    for (int i = 0; i <= R; ++i) {
        f[i].reserve(i+1);
        f[i].resize(i+1, INF);
    }

    f[1][1] = C;
    int ans = INF, x;
    for (int i = 1; i <= R; ++i) {
        for (int j = 1; j <= i; ++j) if(f[i][j]<INF){
            x = f[i][j] + (N - i + j - 1) / j * V;
            if (x < ans)ans = x;

            x = f[i][j] + C;
            if (x < f[i][i])f[i][i] = x;

            int ii = i + j;
            if (ii > R)ii = R;
            x = f[i][j] + V;
            if (x < f[ii][j])f[ii][j] = x;
        }
    }
    cout << ans << endl;
}
0