結果

問題 No.909 たぴの配置
ユーザー rok_dwrok_dw
提出日時 2020-03-21 04:47:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 368 ms / 3,000 ms
コード長 1,282 bytes
コンパイル時間 2,122 ms
コンパイル使用メモリ 165,760 KB
実行使用メモリ 4,748 KB
最終ジャッジ日時 2023-08-22 13:14:48
合計ジャッジ時間 8,082 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 356 ms
4,620 KB
testcase_06 AC 368 ms
4,616 KB
testcase_07 AC 337 ms
4,396 KB
testcase_08 AC 360 ms
4,708 KB
testcase_09 AC 368 ms
4,656 KB
testcase_10 AC 332 ms
4,400 KB
testcase_11 AC 336 ms
4,376 KB
testcase_12 AC 348 ms
4,748 KB
testcase_13 AC 361 ms
4,616 KB
testcase_14 AC 327 ms
4,400 KB
testcase_15 AC 341 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    //ios::sync_with_stdio(false); cin.tie(0);

    int n;
    cin>>n;

    vi x(n),y(n);
    REP(i,n) cin>>x[i];
    REP(i,n) cin>>y[i];

    int mx = 0;
    int mn = 10e6;
    int mnidx = 0;
    REP(i,n){
        if(mn > x[i]+y[i]){
            mn = x[i]+y[i];
            mnidx = i;
        }
    }

    cout << mn << endl;
    cout << "0" << endl;
    REP(i,n){
        int dist = 0;
        if(i==mnidx)
            dist = x[i];
        else if(x[i]>y[i]){
            dist = max(0, mn-y[i]);
        }else
            dist = x[i];

        cout << dist << endl;
    }
    cout << mn << endl;

    return 0;
}
0