結果

問題 No.909 たぴの配置
ユーザー Mayimg
提出日時 2019-10-20 04:36:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 85 ms / 3,000 ms
コード長 623 bytes
コンパイル時間 2,214 ms
コンパイル使用メモリ 195,112 KB
最終ジャッジ日時 2025-01-08 00:03:15
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  vector<int> y(n);
  for (int i = 0; i < n; i++) {
    cin >> y[i];
  }
  int pos = 1 << 30;
  for (int i = 0; i < n; i++) {
    pos = min(pos, x[i] + y[i]);
  }
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    ans[i] = max(0, pos - y[i]);
  }
  cout << pos << '\n';
  cout << 0 << '\n';
  for (int i = 0; i < n; i++) {
    cout << ans[i] << '\n';
  }
  cout << pos << '\n';
  return 0;
}
0