結果

問題 No.553 AlphaCoder Rating
ユーザー kk
提出日時 2021-02-17 18:42:11
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,500 ms
コード長 894 bytes
コンパイル時間 2,082 ms
コンパイル使用メモリ 202,496 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 05:14:37
合計ジャッジ時間 3,094 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

const int INF = 1<<30;

double gsum(double a, int n) {
  return n == INF ? a / (1-a) : (a - pow(a, n+1)) / (1 - a);
}

double F(int n) {
  double num = sqrt(gsum(0.81, n));
  double den = gsum(0.9, n);
  return num / den;
}

double f(int n) {
  return (F(n) - F(INF)) / (F(1) - F(INF)) * 1200;
}

double g(double x) {
  return pow(2.0, x/800);
}

double invg(double x) {
  return 800 * log(x) / log(2.0);
}

double rating(const vector<double> perf) {
  int n = perf.size();
  double sum = 0;
  for (int i = 0; i < n; i++)
    sum += g(perf[i]) * pow(0.9, i + 1);
  sum /= gsum(0.9, n);
  return invg(sum) - f(n);
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  cin >> n;
  vector<double> perf(n);
  for (int i = 0; i < n; i++)
    cin >> perf[i];

  int ret = rating(perf) + 0.5;
  cout << ret << endl;
  
  return 0;
}
0