結果

問題 No.909 たぴの配置
ユーザー finefine
提出日時 2019-10-18 21:32:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 56 ms / 3,000 ms
コード長 702 bytes
コンパイル時間 1,529 ms
コンパイル使用メモリ 166,784 KB
実行使用メモリ 6,340 KB
最終ジャッジ日時 2023-09-07 21:25:43
合計ジャッジ時間 4,536 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 50 ms
5,884 KB
testcase_06 AC 53 ms
6,188 KB
testcase_07 AC 49 ms
5,884 KB
testcase_08 AC 56 ms
5,908 KB
testcase_09 AC 56 ms
6,204 KB
testcase_10 AC 50 ms
5,940 KB
testcase_11 AC 51 ms
5,984 KB
testcase_12 AC 53 ms
6,340 KB
testcase_13 AC 54 ms
6,192 KB
testcase_14 AC 51 ms
5,896 KB
testcase_15 AC 50 ms
5,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> x(n), y(n);
    for (int i = 0; i < n; i++) cin >> x[i];
    for (int i = 0; i < n; i++) cin >> y[i];

    ll maxv = 1e18;
    for (int i = 0; i < n; i++) {
        maxv = min(maxv, x[i] + y[i]);
    }

    cout << maxv << "\n";
    cout << 0 << "\n";
    for (int i = 0; i < n; i++) {
        if (x[i] <= maxv) {
            cout << x[i] << "\n";
        } else if (y[i] <= maxv) {
            cout << maxv - y[i] << "\n";
        } else {
            cout << 0 << "\n";
        }
    }
    cout << maxv << "\n";
    return 0;
}
0