結果

問題 No.909 たぴの配置
ユーザー tonyu0tonyu0
提出日時 2019-10-26 01:00:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 132 ms / 3,000 ms
コード長 589 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 63,844 KB
実行使用メモリ 6,656 KB
最終ジャッジ日時 2023-10-11 13:20:34
合計ジャッジ時間 5,580 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 126 ms
6,420 KB
testcase_06 AC 130 ms
6,536 KB
testcase_07 AC 120 ms
6,292 KB
testcase_08 AC 127 ms
6,372 KB
testcase_09 AC 132 ms
6,488 KB
testcase_10 AC 122 ms
6,248 KB
testcase_11 AC 121 ms
6,212 KB
testcase_12 AC 122 ms
6,656 KB
testcase_13 AC 125 ms
6,476 KB
testcase_14 AC 123 ms
6,344 KB
testcase_15 AC 120 ms
6,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
using ll = long long;
constexpr ll INF = 1LL << 60;
ll N, X[200020], Y[200020], ans, minX, minY;

int main() {
  cin >> N;
  REP(i,N) cin >> X[i];
  REP(i,N) cin >> Y[i];

  ans = INF;
  REP(i,N) {
    if(ans > X[i] + Y[i]) {
      ans = X[i] + Y[i];
      minX = X[i], minY = Y[i];
    }
  }
  
  cout << ans << '\n' << 0 << '\n';
  REP(i,N) {
    if(X[i] <= minX) cout << X[i];
    else if(Y[i] <= minY) cout << ans - Y[i];
    else cout << minX;
    cout << '\n';
  }
  cout << ans << '\n';
  return 0;
}
0