結果
問題 | No.1104 オンライン点呼 |
ユーザー |
|
提出日時 | 2020-07-03 22:02:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 718 bytes |
コンパイル時間 | 1,424 ms |
コンパイル使用メモリ | 169,832 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-09-17 01:04:28 |
合計ジャッジ時間 | 2,777 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 1 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;constexpr char newl = '\n';constexpr ll INF = 1e17;int main() {cin.tie(nullptr);ios::sync_with_stdio(false);int n;ll K;cin >> n >> K;vector<ll> a(n), b(n);for (int i = 0; i < n; i++) {cin >> a[i];}for (int i = 0; i < n; i++) {cin >> b[i];}vector<ll> dp(n, INF);dp[0] = 0;ll ans = 0;for (int i = 1; i < n; i++) {dp[i] = min(dp[i], dp[i - 1] + a[i - 1] + b[i]);if (i > 1) dp[i] = min(dp[i], dp[i - 2] + a[i - 2] + b[i] + K);//cerr << dp[i] << newl;ans = max(ans, dp[i]);}cout << ans << newl;return 0;}