結果

問題 No.555 世界史のレポート
ユーザー BantakoBantako
提出日時 2017-08-12 00:12:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,885 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 1,460 ms
コンパイル使用メモリ 164,964 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-03 00:19:31
合計ジャッジ時間 20,900 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 10 ms
4,376 KB
testcase_03 AC 32 ms
4,380 KB
testcase_04 AC 40 ms
4,380 KB
testcase_05 AC 47 ms
4,384 KB
testcase_06 AC 54 ms
4,380 KB
testcase_07 AC 62 ms
4,380 KB
testcase_08 AC 69 ms
4,376 KB
testcase_09 AC 77 ms
4,380 KB
testcase_10 AC 1,722 ms
4,380 KB
testcase_11 AC 1,801 ms
4,380 KB
testcase_12 AC 1,718 ms
4,380 KB
testcase_13 AC 1,606 ms
4,384 KB
testcase_14 AC 1,775 ms
4,380 KB
testcase_15 AC 1,788 ms
4,376 KB
testcase_16 AC 1,678 ms
4,380 KB
testcase_17 AC 1,749 ms
4,380 KB
testcase_18 AC 1,810 ms
4,384 KB
testcase_19 AC 1,885 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
int cp[50001];
int pa[50001];
main(){
    int N,C,V;
    cin >> N >> C >> V;
    fill(cp,cp+50001,INF);
    fill(pa,pa+50001,INF);
    cp[1] = C;
    pa[1] = 0;
    for(int i = 1;i <= N;i++){
        for(int j = 1;i*(j-1) <= N;j++){
            if(i+i*j > N)pa[N] = min(pa[N],cp[i]+V*j);
            else pa[i+i*j] = min(pa[i+i*j],cp[i]+V*j);
        }
        for(int j = i;j <= 50000;j++){
            cp[j] = min(cp[j],pa[j]+C);
        }
    }
    cout << pa[N] << endl;
}
0