結果

問題 No.909 たぴの配置
ユーザー NacoNaco
提出日時 2019-10-19 18:47:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 376 ms / 3,000 ms
コード長 589 bytes
コンパイル時間 2,505 ms
コンパイル使用メモリ 166,560 KB
実行使用メモリ 5,468 KB
最終ジャッジ日時 2023-09-09 22:15:57
合計ジャッジ時間 8,295 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 362 ms
5,156 KB
testcase_06 AC 372 ms
5,328 KB
testcase_07 AC 344 ms
5,156 KB
testcase_08 AC 364 ms
5,468 KB
testcase_09 AC 376 ms
5,428 KB
testcase_10 AC 341 ms
5,260 KB
testcase_11 AC 342 ms
5,236 KB
testcase_12 AC 351 ms
5,424 KB
testcase_13 AC 369 ms
5,316 KB
testcase_14 AC 344 ms
5,208 KB
testcase_15 AC 344 ms
5,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N; cin >> N;
    int res=1e8;
    int x[N+1];
    int y[N+1];
    for(int i=1;i<=N;i++){
        cin >> x[i];
    }
    for(int i=1;i<=N;i++){
        cin >> y[i];
    }
    for(int i=1;i<=N;i++){
        res=min(res,x[i]+y[i]);
    }
    vector<int> ans(N+2);
    ans[0]=0;
    ans[N+1]=res;
    for(int i=1;i<=N;i++){
        if(x[i]>res){
            ans[i]=res;
        }else{
            ans[i]=x[i];
        }
        
    }
    cout << res << endl;
    for(int i=0;i<N+2;i++){
        cout << ans[i] << endl;
    }
}
0