結果

問題 No.909 たぴの配置
ユーザー toto6114toto6114
提出日時 2019-10-22 12:17:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 301 ms / 3,000 ms
コード長 709 bytes
コンパイル時間 729 ms
コンパイル使用メモリ 90,364 KB
実行使用メモリ 5,092 KB
最終ジャッジ日時 2023-09-15 15:23:29
合計ジャッジ時間 6,192 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,888 KB
testcase_01 AC 3 ms
4,936 KB
testcase_02 AC 3 ms
4,880 KB
testcase_03 AC 2 ms
4,912 KB
testcase_04 AC 2 ms
4,940 KB
testcase_05 AC 286 ms
4,892 KB
testcase_06 AC 296 ms
4,916 KB
testcase_07 AC 275 ms
4,948 KB
testcase_08 AC 288 ms
4,944 KB
testcase_09 AC 301 ms
5,060 KB
testcase_10 AC 277 ms
4,944 KB
testcase_11 AC 277 ms
4,984 KB
testcase_12 AC 285 ms
4,948 KB
testcase_13 AC 297 ms
4,884 KB
testcase_14 AC 272 ms
5,092 KB
testcase_15 AC 268 ms
4,972 KB
権限があれば一括ダウンロードができます

ソースコード

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