結果

問題 No.909 たぴの配置
ユーザー Kaso_uKaso_u
提出日時 2019-10-19 00:22:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 853 bytes
コンパイル時間 1,518 ms
コンパイル使用メモリ 168,836 KB
実行使用メモリ 4,708 KB
最終ジャッジ日時 2023-09-08 03:05:27
合計ジャッジ時間 9,520 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 367 ms
4,628 KB
testcase_13 WA -
testcase_14 AC 337 ms
4,380 KB
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int N;
  cin >> N;
  //vector<ll int> zahyou(N+2);
  vector<int> X(N);
  vector<int> Y(N);
  int saishou, flag=0;
  int num=0;
  
  for(int i=0;i<N;i++){
    cin >> X.at(i);
  }
  for(int i=0;i<N;i++){
    cin >> Y.at(i);
  }
  
  saishou = X.at(0)+Y.at(0);
  for(int i=0;i<N;i++){
    saishou = min(saishou, X.at(i)+Y.at(i));
  }
  
  for(int i=0;i<N;i++){
    if(saishou==X.at(i)+Y.at(i)){
      num = i;
      break;
    }
  }
  
  cout << Y.at(num)+X.at(num) << endl;
  
  for(int i=0;i<N+2;i++){
    if(i==0){
      cout << 0 << endl;
    }
    else if(i==N+1){
      cout << Y.at(num)+X.at(num) << endl;
    }
    else{
      if(X.at(i-1)>Y.at(num)+X.at(num))
        cout << X.at(num) << endl;
      else
      	cout << X.at(i-1) << endl;
    }
  }  
  return 0;
}
0