結果
| 問題 |
No.555 世界史のレポート
|
| コンテスト | |
| ユーザー |
ats5515
|
| 提出日時 | 2017-08-11 23:01:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 934 bytes |
| コンパイル時間 | 647 ms |
| コンパイル使用メモリ | 69,476 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-10-12 21:41:10 |
| 合計ジャッジ時間 | 1,375 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 14 |
ソースコード
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
signed main() {
int N;
int c, v;
cin >> N;
cin >> c >> v;
vector<vector<int> > dp(20);
for (int j = 0; j < 20; j++) {
dp[j].resize(N, 10000000000);
}
dp[1][1] = 0;
int res = 10000000000;
int t;
for (int i = 1; i < N; i++) {
for (int j = 1; j < 20; j++) {
if (j < 19) {
t = i + (1 << (j - 1));
if (t < N) {
dp[j + 1][t] = min(dp[j + 1][t], dp[j][i] + c + v);
}
else {
res = min(res, dp[j][i] + c + v);
}
}
if (j > 1) {
t = i + (1 << (j - 2));
if (t < N) {
dp[j][t] = min(dp[j][t], dp[j][i] + v);
}
else {
res = min(res, dp[j][i] + v);
}
}
}
}
/*
for (int i = 1; i < N; i++) {
for (int j = 1; j < 5; j++) {
cerr << dp[j][i] << " ";
}
cerr << endl;
}
*/
cout << res << endl;
return 0;
}
ats5515