結果

問題 No.909 たぴの配置
ユーザー Ogtsn99Ogtsn99
提出日時 2019-10-18 21:38:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 386 ms / 3,000 ms
コード長 1,166 bytes
コンパイル時間 1,913 ms
コンパイル使用メモリ 166,720 KB
実行使用メモリ 6,232 KB
最終ジャッジ日時 2023-09-07 21:38:09
合計ジャッジ時間 7,843 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 370 ms
5,928 KB
testcase_06 AC 380 ms
6,220 KB
testcase_07 AC 353 ms
5,908 KB
testcase_08 AC 373 ms
6,084 KB
testcase_09 AC 386 ms
6,156 KB
testcase_10 AC 355 ms
6,032 KB
testcase_11 AC 349 ms
5,940 KB
testcase_12 AC 368 ms
5,932 KB
testcase_13 AC 383 ms
6,232 KB
testcase_14 AC 356 ms
6,228 KB
testcase_15 AC 353 ms
6,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

signed main(void){
    int n; cin>>n;
    vector <int> a(n), b(n);
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];
    int ma = INF;
    rep(i,n) ma = min(ma, a[i]+ b[i]);
    cout<<ma<<endl;
    for(int i=0;i<n+2;i++){
        if(i==0) cout<<0<<endl;
        else if(i==n+1) cout<<ma<<endl;
        else{
            //cout<<a[i-1]<<' '<<b[i-1]<<endl;
            int mi = min(a[i-1], b[i-1]);
            if(a[i-1] == mi){
                if(a[i-1] > ma) cout<<ma<<endl;
                else cout<<a[i-1]<<endl;
            }else{
                if(ma-mi < 0) cout<<0<<endl;
                else cout<<ma - mi<<endl;
            }
        }
    }
}
0