結果

問題 No.909 たぴの配置
ユーザー cotton_fn_cotton_fn_
提出日時 2019-12-12 15:09:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 129 ms / 3,000 ms
コード長 769 bytes
コンパイル時間 883 ms
コンパイル使用メモリ 100,304 KB
実行使用メモリ 4,788 KB
最終ジャッジ日時 2023-09-07 07:13:20
合計ジャッジ時間 6,745 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 123 ms
4,684 KB
testcase_06 AC 129 ms
4,732 KB
testcase_07 AC 118 ms
4,416 KB
testcase_08 AC 124 ms
4,704 KB
testcase_09 AC 128 ms
4,788 KB
testcase_10 AC 119 ms
4,472 KB
testcase_11 AC 118 ms
4,376 KB
testcase_12 AC 120 ms
4,548 KB
testcase_13 AC 125 ms
4,644 KB
testcase_14 AC 119 ms
4,424 KB
testcase_15 AC 118 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <utility>
#include <tuple>
#include <string>
#include <cstdint>
#include <vector>
#include <array>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <cassert>
using namespace std;
using i64 = int64_t;
int n;
vector<int> xs, ys;
int main() {
    cin >> n;
    xs.resize(n + 2);
    ys.resize(n + 2);
    for (int i = 1; i <= n; ++i) cin >> xs[i];
    for (int i = 1; i <= n; ++i) cin >> ys[i];
    xs[n + 1] = 1 << 28;
    for (int i = 1; i <= n; ++i) {
        xs[n + 1] = min(xs[n + 1], xs[i] + ys[i]);
    }
    for (int i = 1; i <= n; ++i) {
        xs[i] = min(xs[i], xs[n + 1]);
    }
    cout << xs[n + 1] << '\n';
    for (int i = 0; i <= n + 1; ++i) cout << xs[i] << '\n';
    return 0;
}
0