結果

問題 No.909 たぴの配置
ユーザー toto6114
提出日時 2019-10-22 12:17:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 301 ms / 3,000 ms
コード長 709 bytes
コンパイル時間 754 ms
コンパイル使用メモリ 93,036 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-02 18:05:40
合計ジャッジ時間 6,261 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0), cout.precision(10);
  int n,x[200000]={},y[200000]={},d=1e9;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> x[i];
  }
  for(int i=0; i<n; i++) {
    cin >> y[i];
  }
  for(int i=0; i<n; i++) {
    d=min(d,x[i]+y[i]);
  }
  cout << d << endl;
  cout << 0 << endl;
  for(int i=0; i<n; i++) {
    if(x[i]>=y[i]) {
      cout << max(0,d-y[i]) << endl;
    }
    else {
      cout << min(d,x[i]) << endl;
    }
  }
  cout << d << endl;
}
0