結果

問題 No.2009 Drunkers' Contest
ユーザー SSRSSSRS
提出日時 2022-07-15 22:32:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 924 bytes
コンパイル時間 1,810 ms
コンパイル使用メモリ 174,920 KB
実行使用メモリ 14,872 KB
最終ジャッジ日時 2023-09-10 03:18:49
合計ジャッジ時間 8,012 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
11,480 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 WA -
testcase_14 AC 15 ms
4,380 KB
testcase_15 AC 17 ms
4,380 KB
testcase_16 AC 3 ms
4,384 KB
testcase_17 AC 19 ms
4,380 KB
testcase_18 AC 11 ms
4,384 KB
testcase_19 AC 46 ms
4,384 KB
testcase_20 AC 53 ms
4,380 KB
testcase_21 AC 13 ms
4,380 KB
testcase_22 AC 53 ms
4,384 KB
testcase_23 AC 77 ms
4,380 KB
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const double INF = 1000000000;
int main(){
  cout << fixed << setprecision(20);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  vector<int> B(N);
  for (int i = 0; i < N; i++){
    cin >> B[i];
  }
  vector<long long> SA(N + 1), SB(N + 1);
  SA[N] = 0;
  SB[N] = 0;
  for (int i = N - 1; i >= 0; i--){
    SA[i] = SA[i + 1] + A[i];
    SB[i] = SB[i + 1] + B[i];
  }
  vector<double> X;
  for (int i = 0; i < N; i++){
    double x = sqrt((double) SA[i] / SB[i]);
    if (x > 1){
      X.push_back(x);
    }
  }
  X.push_back(1);
  sort(X.begin(), X.end());
  int M = X.size();
  vector<double> dp(M, 0);
  for (int i = N - 1; i >= 0; i--){
    for (int j = 0; j < M; j++){
      dp[j] += A[i] / X[j] + B[i] * X[j];
    }
    for (int j = M - 2; j >= 0; j--){
      dp[j] = min(dp[j], dp[j + 1]);
    }
  }
  cout << dp[0] << endl;
}
0