結果

問題 No.909 たぴの配置
ユーザー fine
提出日時 2019-10-18 21:32:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 55 ms / 3,000 ms
コード長 702 bytes
コンパイル時間 1,803 ms
コンパイル使用メモリ 169,708 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-06-25 15:03:12
合計ジャッジ時間 4,452 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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