結果

問題 No.909 たぴの配置
ユーザー horoyoisawahoroyoisawa
提出日時 2022-02-03 08:30:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 383 ms / 3,000 ms
コード長 501 bytes
コンパイル時間 1,712 ms
コンパイル使用メモリ 165,432 KB
実行使用メモリ 5,884 KB
最終ジャッジ日時 2023-09-02 03:05:07
合計ジャッジ時間 8,622 ms
ジャッジサーバーID
(参考情報)
judge13 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 358 ms
5,680 KB
testcase_06 AC 383 ms
5,804 KB
testcase_07 AC 347 ms
5,496 KB
testcase_08 AC 364 ms
5,644 KB
testcase_09 AC 380 ms
5,668 KB
testcase_10 AC 352 ms
5,620 KB
testcase_11 AC 346 ms
5,616 KB
testcase_12 AC 358 ms
5,616 KB
testcase_13 AC 367 ms
5,884 KB
testcase_14 AC 348 ms
5,500 KB
testcase_15 AC 347 ms
5,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    int x[n], y[n], ans[n+2];
    int pos = INT_MAX;
    for(int i=0;i<n;i++) cin >> x[i];
    for(int i=0;i<n;i++) {
        cin >> y[i];
        pos = min(pos, x[i] + y[i]);
    }
    ans[0] = 0;
    ans[n+1] = pos;
    for(int i=1;i<=n;i++) {
        if(x[i-1] >= pos) ans[i] = pos;
        else ans[i] = x[i-1];
    }

    cout << pos << endl;

    for(int i=0;i<n+2;i++) cout << ans[i] << endl;

    return 0;
}
0