結果

問題 No.553 AlphaCoder Rating
ユーザー alpha_virginisalpha_virginis
提出日時 2017-08-11 22:38:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 1,500 ms
コード長 2,367 bytes
コンパイル時間 1,722 ms
コンパイル使用メモリ 168,508 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 22:53:05
合計ジャッジ時間 2,135 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef std::vector<long> LI;
typedef std::queue<long> QI;
#define rep(i,n) for(long i = 0; i < (long)n; ++i)
const double pi = M_PI;
const long mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   double lf(long n) {
      double x = 0, y = 0;
      for(long i = 1; i <= n; ++i) {
         x += pow(0.81, i);
      }
      x = sqrt(x);
      for(long i = 1; i <= n; ++i) {
         y += pow(0.9, i);
      }
      return x/y;
   }
   double lfinf;
   double f(long n) {
      return (lf(n) - lfinf)/(lf(1)-lfinf) * 1200;
   }
   double g(long x) {
      return pow(2.0, x / 800.0);
   }
   double ginv(double x) {
      return 800.0 * log(x) / log(2);
   }
   double rating(LI xs) {
      long n = xs.size();
      double a = 0, b = 0;
      for(long i = 1; i <= n; ++i) {
         a += g(xs[i-1])*pow(0.9, i);
      }
      for(long i = 1; i <= n; ++i) {
         b += pow(0.9, i);
      }
      return ginv(a/b)-f(n);
   }
   void solve() {
      lfinf = lf(10000);
      long n; scan(n);
      LI xs(n); for(long &x : xs) scan(x);
      double res = rating(xs);
      printf("%ld\n", (long)(res+0.5));
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}

0