結果
| 問題 |
No.2150 Site Supporter
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-24 03:59:40 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 71 ms / 2,000 ms |
| コード長 | 629 bytes |
| コンパイル時間 | 1,623 ms |
| コンパイル使用メモリ | 94,848 KB |
| 最終ジャッジ日時 | 2025-02-09 19:55:38 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#include <array>
#include <iostream>
#include <limits>
#include <vector>
constexpr uint64_t inf = std::numeric_limits<uint64_t>::max() / 2;
int main() {
size_t n;
uint64_t k, x;
std::cin >> n >> k >> x;
std::array<uint64_t, 2> pd{ 0, inf };
for (uint64_t i = 0; i < n; ++i) {
uint64_t c;
std::cin >> c;
std::array<uint64_t, 2> dp{ inf, inf };
for (bool f : { 0, 1 }) for (bool g : { 0, 1 }) {
dp[g] = std::min(dp[g], pd[f] + (not g) * c + g * k + (not f and g) * x);
}
dp.swap(pd);
}
std::cout << std::min(pd[0], pd[1]) << std::endl;
}