結果

問題 No.909 たぴの配置
ユーザー たぴちゃん
提出日時 2019-10-18 16:12:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 375 ms / 3,000 ms
コード長 586 bytes
コンパイル時間 1,867 ms
コンパイル使用メモリ 193,764 KB
最終ジャッジ日時 2025-01-07 22:25:20
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int n;
    cin >> n;
    assert(1 <= n && n <= 200000);
    vector<int> x(n), y(n);
    for(int i = 0; i < n; i++){
        cin >> x[i];
        assert(0 <= x[i] && x[i] <= 1000000);
    }
    for(int i = 0; i < n; i++){
        cin >> y[i];
        assert(0 <= y[i] && y[i] <= 1000000);
    }
    int MIN = x[0] + y[0];
    for(int i = 1; i < n; i++) MIN = min(MIN, x[i] + y[i]);
    cout << MIN << endl << 0 << endl;
    for(int i = 0; i < n; i++) cout << max(min(x[i], MIN - y[i]), 0) << endl;
    cout << MIN << endl;
}
0