結果

問題 No.1104 オンライン点呼
ユーザー coco18000coco18000
提出日時 2020-07-04 22:33:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 827 bytes
コンパイル時間 1,945 ms
コンパイル使用メモリ 167,492 KB
実行使用メモリ 5,972 KB
最終ジャッジ日時 2023-10-19 17:54:03
合計ジャッジ時間 5,010 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 25 ms
5,972 KB
testcase_02 AC 24 ms
5,972 KB
testcase_03 AC 19 ms
5,972 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 12 ms
4,992 KB
testcase_08 AC 6 ms
4,348 KB
testcase_09 AC 13 ms
5,800 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 9 ms
4,580 KB
testcase_12 AC 12 ms
5,032 KB
testcase_13 AC 10 ms
4,464 KB
testcase_14 AC 3 ms
4,348 KB
testcase_15 AC 15 ms
5,140 KB
testcase_16 WA -
testcase_17 AC 12 ms
4,784 KB
testcase_18 AC 14 ms
5,140 KB
testcase_19 AC 20 ms
5,540 KB
testcase_20 AC 22 ms
5,700 KB
testcase_21 AC 21 ms
5,720 KB
testcase_22 AC 18 ms
5,344 KB
testcase_23 AC 14 ms
4,972 KB
testcase_24 AC 7 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[100005];
ll B[100005];

//! 社員iの声がサーバーにアップされる時間
ll C[100005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    REP(i, N) {
        cin >> A[i];
    }
    REP(i, N) {
        cin >> B[i];
    }
    C[0] = A[0];
    C[1] = A[0] + B[1] + A[1];
    FOR(i, N, 2) {
        C[i] = std::min(C[i - 1] + A[i] + B[i], C[i - 2] + A[i] + B[i] + K);
    }

    ll ans = 0;
    REP(i, N) {
        ans = std::max(ans, C[i] - A[i]);
    }

    cout << ans << endl;
    return 0;
}
0