結果

問題 No.909 たぴの配置
ユーザー auauaauaua
提出日時 2019-10-18 21:51:16
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 388 ms / 3,000 ms
コード長 673 bytes
コンパイル時間 2,078 ms
コンパイル使用メモリ 146,064 KB
実行使用メモリ 6,256 KB
最終ジャッジ日時 2023-09-07 21:57:16
合計ジャッジ時間 8,509 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 361 ms
5,996 KB
testcase_06 AC 378 ms
6,200 KB
testcase_07 AC 348 ms
5,892 KB
testcase_08 AC 373 ms
5,884 KB
testcase_09 AC 388 ms
6,232 KB
testcase_10 AC 355 ms
6,064 KB
testcase_11 AC 352 ms
6,256 KB
testcase_12 AC 365 ms
6,196 KB
testcase_13 AC 379 ms
6,196 KB
testcase_14 AC 349 ms
5,996 KB
testcase_15 AC 363 ms
6,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
int main(){
    ll n;cin>>n;
    vector<ll>x(n);
    vector<ll>y(n);
    ll mi=inf;
    rep(i,n){
        cin>>x[i];
    }
    rep(i,n){
        cin>>y[i];
    }
    rep(i,n){
        mi=min(mi,x[i]+y[i]);
    }
    cout<<mi<<endl;
    cout<<0<<endl;
    rep(i,n){
        if(x[i]<=mi)cout<<x[i]<<endl;
        else if(y[i]<=mi)cout<<mi-y[i]<<endl;
        else cout<<0<<endl;
    }
    cout<<mi<<endl;
}
0