結果

問題 No.5018 Let's Make a Best-seller Book
ユーザー Shun_PIShun_PI
提出日時 2023-10-01 14:47:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,597 bytes
コンパイル時間 3,153 ms
コンパイル使用メモリ 194,316 KB
実行使用メモリ 24,516 KB
スコア 0
平均クエリ数 40.27
最終ジャッジ日時 2023-10-01 14:47:29
合計ジャッジ時間 10,865 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 WA -
testcase_83 WA -
testcase_84 WA -
testcase_85 WA -
testcase_86 WA -
testcase_87 WA -
testcase_88 WA -
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 WA -
testcase_93 WA -
testcase_94 WA -
testcase_95 WA -
testcase_96 WA -
testcase_97 WA -
testcase_98 WA -
testcase_99 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr lint B1 = 1532834020;
constexpr lint M1 = 2147482409;
constexpr lint B2 = 1388622299;
constexpr lint M2 = 2147478017;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
template<class T>void chmax(T &a, const T &b) { if (a<b) a=b; }
template<class T>void chmin(T &a, const T &b) { if (b<a) a=b; }
constexpr bool DEBUG = false;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T, N, Money;
  cin >> T >> N;
  if(!DEBUG) cin >> Money;
  else Money = 2000000;
  vector<int> R(N), P(N);
  vector<double> D(N);
  if(DEBUG) REP(i, N) cin >> D[i];
  vector<vector<double>> Z(T, vector<double>(N));
  if(DEBUG) REP(i, T) REP(j, N) cin >> Z[i][j];

  vector<double> weight(N);
  REP(i, N) weight[i] = 1.0 / N;

  int score = 0;
  REP(t, T) {
    /*
    cerr << t << endl;
    cerr << Money << endl;
    REP(i, N) cerr << R[i] << " ";
    cerr << endl;
    REP(i, N) cerr << P[i] << " ";
    cerr << endl;
    */

    int mode = 1;
    vector<int> L(N);
    int x = 1;

    // 行動を決める
    int MODE_CHANGE_TURN = 60;
    double THRESHOLD_D = 0.5 + 0.7 * t / T;
    double THRESHOLD_Z = 0.75;
    int limL = Money / 500 / N;
    if(t < MODE_CHANGE_TURN) {
      REP(i, N) {
        int l = 3;
        int r = 1e9;
        while(r-l > 1) {
          int m = (l+r)/2;
          if(sqrt(m) * pow(1.05, P[i]) * THRESHOLD_D * THRESHOLD_Z >= 0.3 * m) l = m;
          else r = m;
        }
        L[i] = max(0, l - R[i]);
        chmin(L[i], limL);
      }
    } else {
      REP(i, N) if(P[i] < 0) weight[i] = 0;
      double weight_sum = 0;
      REP(i, N) weight_sum += weight[i];
      REP(i, N) weight[i] /= weight_sum;
      REP(i, N) L[i] = Money / 500 * weight[i];
    }
    REP(i, N) assert(L[i] >= 0);
    if(Money >= 5000000) {
      mode = 2;
      x = 4;
    }
    if(Money >= 9000000) {
      mode = 2;
      x = 5;
    }

    cout << mode << " ";
    if(mode == 1) {
      REP(i, N) cout << L[i] << (i!=N-1 ? " " : "");
      REP(i, N) R[i] += L[i];
      REP(i, N) Money -= 500 * L[i];
    } else {
      cout << x;
      REP(i, N) P[i] = min(60, P[i] + x);
      Money -= 500000 * pow(2, x-1);
    }
    cout << "\n";
    cout.flush();

    assert(Money >= 0);
    cerr << Money << endl;

    vector<int> S(N);
    if(!DEBUG) {
      cin >> Money;
      if(Money == -1) {
        cerr << "Money is -1" << endl;
        return 0;
      }
      REP(i, N) cin >> S[i];
    }
    //結果の受け取り
    REP(i, N) {
      int s = S[i];
      if(DEBUG) s = min(R[i], (int)floor(sqrt(R[i]) * pow(1.05, P[i]) * D[i] * Z[t][i]));
      score += s;
      Money += 1000 * s;

      //double estimate_D = s / sqrt(R[i]) / pow(1.05, P[i]);
      //if(estimate_D > 1.0) weight[i] *= 1.0;
      //else weight[i] /= 1.0;

      if(R[i] > 0) {
        if(s >= 0.3 * R[i]) P[i] = min(60, P[i] + 1);
        else if(s <= 0.1 * R[i]) P[i] = max(-60, P[i] - 1);
      }
      R[i] -= s;
    }

    if(!DEBUG) {
      REP(i, N) cin >> P[i];
      REP(i, N) cin >> R[i];
    }
  }
  cerr << score/100 << endl;
}
0