結果

問題 No.909 たぴの配置
ユーザー qsako6qsako6
提出日時 2019-10-18 22:32:33
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 291 ms / 3,000 ms
コード長 2,034 bytes
コンパイル時間 1,662 ms
コンパイル使用メモリ 123,876 KB
実行使用メモリ 5,820 KB
最終ジャッジ日時 2023-09-08 00:25:03
合計ジャッジ時間 7,022 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 272 ms
5,720 KB
testcase_06 AC 291 ms
5,620 KB
testcase_07 AC 259 ms
5,492 KB
testcase_08 AC 268 ms
5,820 KB
testcase_09 AC 282 ms
5,760 KB
testcase_10 AC 260 ms
5,568 KB
testcase_11 AC 269 ms
5,768 KB
testcase_12 AC 276 ms
5,632 KB
testcase_13 AC 289 ms
5,736 KB
testcase_14 AC 271 ms
5,636 KB
testcase_15 AC 258 ms
5,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;
using i64 = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const int INF = (1 << 30);
const i64 INFL = (1LL << 62);
const i64 MOD = 1000000007;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
i64 mod_pow(i64 a, i64 n, T mod) {
  mod = (i64)mod;
  i64 res = 1, p = a % mod;
  while (n) {
    if (n & 1) res = res * p % mod;
    p = p * p % mod;
    n >>= 1;
  }
  return res;
}
void print() { std::cout << std::endl; }
template <typename T, typename... A>
void print(const T& first, const A&... rest) {
  cout << sizeof...(rest) << endl;
  std::cout << first;
  if (sizeof...(rest)) std::cout << " ";
  print(rest...);
}
template <typename... A>
void print(const A&... rest) {
  print(rest...);
}
template <typename A>
void print(const std::vector<A>& v) {
  std::for_each(v.begin(), v.end(), [](A x) { std::cout << x << " "; });
  std::cout << std::endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> x(n);
  vector<int> y(n);
  rep(i, n) { cin >> x.at(i); }
  rep(i, n) { cin >> y.at(i); }
  int min_len = INF;
  rep(i, n) { min_len = min(x[i] + y[i], min_len); }
  cout << min_len << endl;
  vector<int> pos;
  pos.push_back(0);
  rep(i, n) { pos.push_back(x[i] > y[i] ? min_len - y[i] : x[i]); }
  pos.push_back(min_len);
  int min_pos = *min_element(all(pos));
  rep(i, n+2){
    if(min_pos < 0){
      cout << abs(min_pos) + pos[i] << endl;
    }else{
      cout << pos[i] << endl;
    }
  }

  return 0;
}
0