結果

問題 No.5003 物理好きクリッカー
ユーザー morumottomorumotto
提出日時 2018-12-10 03:30:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 131 ms / 10,000 ms
コード長 2,969 bytes
コンパイル時間 62 ms
実行使用メモリ 22,888 KB
スコア 17,173,158,407
平均クエリ数 10000.00
最終ジャッジ日時 2021-07-19 09:18:02
合計ジャッジ時間 6,424 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
22,352 KB
testcase_01 AC 129 ms
22,404 KB
testcase_02 AC 130 ms
22,600 KB
testcase_03 AC 130 ms
22,536 KB
testcase_04 AC 131 ms
22,632 KB
testcase_05 AC 131 ms
22,524 KB
testcase_06 AC 127 ms
22,728 KB
testcase_07 AC 128 ms
22,704 KB
testcase_08 AC 128 ms
22,692 KB
testcase_09 AC 129 ms
22,740 KB
testcase_10 AC 131 ms
22,680 KB
testcase_11 AC 128 ms
22,720 KB
testcase_12 AC 128 ms
22,660 KB
testcase_13 AC 131 ms
22,716 KB
testcase_14 AC 129 ms
22,480 KB
testcase_15 AC 128 ms
22,708 KB
testcase_16 AC 129 ms
22,672 KB
testcase_17 AC 131 ms
22,464 KB
testcase_18 AC 130 ms
22,632 KB
testcase_19 AC 130 ms
22,488 KB
testcase_20 AC 128 ms
22,456 KB
testcase_21 AC 130 ms
22,416 KB
testcase_22 AC 129 ms
22,820 KB
testcase_23 AC 128 ms
22,696 KB
testcase_24 AC 129 ms
22,464 KB
testcase_25 AC 131 ms
22,400 KB
testcase_26 AC 128 ms
22,700 KB
testcase_27 AC 129 ms
22,712 KB
testcase_28 AC 129 ms
22,560 KB
testcase_29 AC 128 ms
22,492 KB
testcase_30 AC 130 ms
22,496 KB
testcase_31 AC 130 ms
22,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
n = int(input())
s = input()
fac_power = {"enhclick":1,
             "hand":1,
             "lily":10,
             "factory":120,
             "casino":2000,
             "grimoire":25000}
buy_count = {"enhclick":0,
             "hand":0,
             "lily":0,
             "factory":0,
             "casino":0,
             "grimoire":0}
buy_price = {"buy hand":150,
             "buy lily":2000,
             "buy factory":30000,
             "buy casino":600000,
             "buy grimoire":10000000}
rei_price = {"enhclick":15,
             "reinforce hand":1500,
             "reinforce lily":20000,
             "reinforce factory":300000,
             "reinforce casino":6000000,
             "reinforce grimoire":100000000}
sell_price = {"sell hand":[],
              "sell lily":[],
              "sell factory":[],
              "sell casino":[],
              "sell grimoire":[]}
fac_names = {"hand", "lily", "factory", "casino", "grimoire"}

CLICK_RATIO = 0.95
turn = 0
cookie_count = 0
fever = 0
sale = False
while turn < n:
  #print(cookie_count)
  #------------- player_action -------------
  act = None
  price = 0
  score = 0
  #buy
  for k, v in buy_price.items():
    if sale:
      v *= 0.9
    if cookie_count >= v:
      ev = fac_power[k.split()[-1]] * (n - turn) - v
      #print(ev)
      if score < ev:
        act, price, score = k, v, ev
  #reinforce
  for k, v in rei_price.items():
    if sale:
      v *= 0.9
    if cookie_count >= v:
      ev = fac_power[k.split()[-1]] * buy_count[k.split()[-1]] * (n - turn) - v
      #print(ev)
      if k == "enhclick":
        ev *= CLICK_RATIO
      if score < ev:
        act, price, score = k, v, ev
  #sell
  for k, v in sell_price.items():
    if not v:continue
    ev =  v[-1] - fac_power[k.split()[-1]] * (n - turn)
    #print(ev)
    if score < ev:
      act, price, score = "sell " + k.split()[-1], - math.ceil(v[-1] * 0.25), ev

  if act == None:
    print("click")
    cookie_count += fac_power["enhclick"]
  else:
    if act in buy_price:
      print(act)
      sell_price["sell "+ act.split()[-1]].append(math.ceil(buy_price[act] * 0.25))
      buy_price[act] = math.ceil(buy_price[act] * 1.2)
      buy_count[act.split()[-1]] += 1
      cookie_count -= math.ceil(price)
    elif act in rei_price:
      print(act)
      rei_price[act] *= 10
      fac_power[act.split()[-1]] *= 2
      cookie_count -= math.ceil(price)
    elif act in sell_price:
      print(act)
      cookie_count += sell_price[act].pop()
      buy_count[act.split()[-1]] -= 1


  #------------- facility_action -----------
  add = sum([fac_power[k] * buy_count[k] for k in fac_names])
  if fever:
    add *= 7
    fever -= 1
  cookie_count += add

  #------------- special_action ------------
  special_act = s[turn]
  if s == "B":
    cookie_count += math.ceil(cookie_count / 100)
  elif s == "F":
    fever = 20
  elif s == "S":
    sale = True

  #------------- turn++ ------------------
  turn += 1
0