結果
問題 | No.5018 Let's Make a Best-seller Book |
ユーザー | Kiri8128 |
提出日時 | 2023-10-01 16:46:33 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 157 ms / 400 ms |
コード長 | 4,402 bytes |
コンパイル時間 | 565 ms |
コンパイル使用メモリ | 87,260 KB |
実行使用メモリ | 92,776 KB |
スコア | 122,659 |
平均クエリ数 | 52.00 |
最終ジャッジ日時 | 2023-10-01 16:46:52 |
合計ジャッジ時間 | 19,342 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 129 ms
88,548 KB |
testcase_01 | AC | 125 ms
88,756 KB |
testcase_02 | AC | 126 ms
92,592 KB |
testcase_03 | AC | 130 ms
92,440 KB |
testcase_04 | AC | 126 ms
88,380 KB |
testcase_05 | AC | 153 ms
88,472 KB |
testcase_06 | AC | 126 ms
88,976 KB |
testcase_07 | AC | 124 ms
88,640 KB |
testcase_08 | AC | 126 ms
88,844 KB |
testcase_09 | AC | 128 ms
92,212 KB |
testcase_10 | AC | 126 ms
88,180 KB |
testcase_11 | AC | 127 ms
92,088 KB |
testcase_12 | AC | 153 ms
92,056 KB |
testcase_13 | AC | 124 ms
88,548 KB |
testcase_14 | AC | 125 ms
88,964 KB |
testcase_15 | AC | 125 ms
88,804 KB |
testcase_16 | AC | 126 ms
92,380 KB |
testcase_17 | AC | 125 ms
88,524 KB |
testcase_18 | AC | 125 ms
88,824 KB |
testcase_19 | AC | 157 ms
92,404 KB |
testcase_20 | AC | 126 ms
92,016 KB |
testcase_21 | AC | 125 ms
88,852 KB |
testcase_22 | AC | 129 ms
92,492 KB |
testcase_23 | AC | 126 ms
88,628 KB |
testcase_24 | AC | 127 ms
88,576 KB |
testcase_25 | AC | 127 ms
88,384 KB |
testcase_26 | AC | 148 ms
88,740 KB |
testcase_27 | AC | 129 ms
92,496 KB |
testcase_28 | AC | 126 ms
88,464 KB |
testcase_29 | AC | 124 ms
88,808 KB |
testcase_30 | AC | 124 ms
88,352 KB |
testcase_31 | AC | 126 ms
88,388 KB |
testcase_32 | AC | 125 ms
88,628 KB |
testcase_33 | AC | 127 ms
88,980 KB |
testcase_34 | AC | 152 ms
88,392 KB |
testcase_35 | AC | 124 ms
88,576 KB |
testcase_36 | AC | 124 ms
88,680 KB |
testcase_37 | AC | 128 ms
88,480 KB |
testcase_38 | AC | 126 ms
89,088 KB |
testcase_39 | AC | 127 ms
88,520 KB |
testcase_40 | AC | 127 ms
92,512 KB |
testcase_41 | AC | 126 ms
88,968 KB |
testcase_42 | AC | 127 ms
88,708 KB |
testcase_43 | AC | 126 ms
88,384 KB |
testcase_44 | AC | 125 ms
88,784 KB |
testcase_45 | AC | 127 ms
88,708 KB |
testcase_46 | AC | 127 ms
88,432 KB |
testcase_47 | AC | 130 ms
91,984 KB |
testcase_48 | AC | 128 ms
92,288 KB |
testcase_49 | AC | 127 ms
88,688 KB |
testcase_50 | AC | 125 ms
88,548 KB |
testcase_51 | AC | 128 ms
92,732 KB |
testcase_52 | AC | 125 ms
88,748 KB |
testcase_53 | AC | 123 ms
88,848 KB |
testcase_54 | AC | 126 ms
92,548 KB |
testcase_55 | AC | 126 ms
88,808 KB |
testcase_56 | AC | 125 ms
88,804 KB |
testcase_57 | AC | 128 ms
92,692 KB |
testcase_58 | AC | 126 ms
88,692 KB |
testcase_59 | AC | 129 ms
92,492 KB |
testcase_60 | AC | 126 ms
89,136 KB |
testcase_61 | AC | 127 ms
88,636 KB |
testcase_62 | AC | 126 ms
88,180 KB |
testcase_63 | AC | 126 ms
89,080 KB |
testcase_64 | AC | 125 ms
88,808 KB |
testcase_65 | AC | 125 ms
88,844 KB |
testcase_66 | AC | 129 ms
92,760 KB |
testcase_67 | AC | 125 ms
88,384 KB |
testcase_68 | AC | 126 ms
88,848 KB |
testcase_69 | AC | 126 ms
88,132 KB |
testcase_70 | AC | 126 ms
88,572 KB |
testcase_71 | AC | 128 ms
88,836 KB |
testcase_72 | AC | 127 ms
92,628 KB |
testcase_73 | AC | 126 ms
92,208 KB |
testcase_74 | AC | 126 ms
92,396 KB |
testcase_75 | AC | 125 ms
88,580 KB |
testcase_76 | AC | 127 ms
88,400 KB |
testcase_77 | AC | 125 ms
88,844 KB |
testcase_78 | AC | 126 ms
92,528 KB |
testcase_79 | AC | 125 ms
88,844 KB |
testcase_80 | AC | 126 ms
92,776 KB |
testcase_81 | AC | 125 ms
88,388 KB |
testcase_82 | AC | 123 ms
88,332 KB |
testcase_83 | AC | 131 ms
88,728 KB |
testcase_84 | AC | 129 ms
92,348 KB |
testcase_85 | AC | 126 ms
92,432 KB |
testcase_86 | AC | 128 ms
92,464 KB |
testcase_87 | AC | 125 ms
89,100 KB |
testcase_88 | AC | 125 ms
88,980 KB |
testcase_89 | AC | 127 ms
92,464 KB |
testcase_90 | AC | 141 ms
88,696 KB |
testcase_91 | AC | 124 ms
88,448 KB |
testcase_92 | AC | 124 ms
88,728 KB |
testcase_93 | AC | 125 ms
88,120 KB |
testcase_94 | AC | 126 ms
92,328 KB |
testcase_95 | AC | 124 ms
88,812 KB |
testcase_96 | AC | 126 ms
88,532 KB |
testcase_97 | AC | 138 ms
88,700 KB |
testcase_98 | AC | 124 ms
88,732 KB |
testcase_99 | AC | 127 ms
88,936 KB |
ソースコード
from random import gauss, random, randrange try: LOCAL except NameError: LOCAL = 0 if LOCAL: DEBUG = 1 LOOP = 1000 else: DEBUG = 0 LOOP = 1 def receive(): global P global R global money global MI, MA if DEBUG: sell_count = [min(R[i], int(R[i] ** 0.5 * 1.05 ** P[i] * D[i] * (0.75 + random() * 0.5))) for i in range(N)] money += 1000 * sum(sell_count) else: money = int(input()) sell_count = [int(a) for a in input().split()] for i in range(N): if R[i]: ma = (sell_count[i] + 1) / (R[i] ** 0.5 * 0.75 * 1.05 ** P[i]) mi = sell_count[i] / (R[i] ** 0.5 * 1.25 * 1.05 ** P[i]) MI[i] = max(mi, MI[i]) if sell_count[i] < R[i]: MA[i] = min(ma, MA[i]) for i in range(N): if R[i]: if sell_count[i] * 10 >= 3 * R[i]: P[i] = min(P[i] + 1, 60) elif sell_count[i] * 10 < R[i]: P[i] = max(P[i] - 1, -60) if DEBUG: for i in range(N): R[i] -= sell_count[i] else: for i, a in enumerate(input().split()): P[i] = int(a) for i, a in enumerate(input().split()): R[i] = int(a) for i in range(N): total_sell_count[i] += sell_count[i] def adj(n): if n < 4: return 3 if n % 10 < 3: return n // 10 * 10 if n % 10 < 6: return n // 10 * 10 + 3 return n // 10 * 10 + 6 def Order(): global P global R global money target = 10 buy_count = [0] * N for i in range(N): if t < 5: target = adj(int(100 / 9 * 1.05 ** P[i] * (MA[i] * 0.0 + MI[i] * 1.0))) elif t < 20: target = adj(int(100 / 9 * 1.05 ** P[i] * (MA[i] * 0.0 + MI[i] * 1.0))) elif t < 40: target = adj(int(100 / 4 * 1.05 ** P[i] * (MA[i] + MI[i]) / 2)) elif t < 45: target = adj(int(100 / 1 * 1.05 ** P[i] * (MA[i] + MI[i]) / 2)) elif t < 48: target = adj(int(100 / 0.3 * 1.05 ** P[i] * (MA[i] + MI[i]) / 2)) else: target = adj(int(100 / 0.05 * 1.05 ** P[i] * (MA[i] + MI[i]) / 2)) buy_count[i] = max(0, target - R[i]) while 1: r = sum(buy_count) * 500 / money if r <= 1: break for i in range(N): buy_count[i] = int(buy_count[i] / r) money -= sum(buy_count) * 500 if money < 0: while 1: pass assert money >= 0 for i in range(N): R[i] += buy_count[i] if not DEBUG: print(1, *buy_count) def Advertise(x): global money money -= 500000 << x - 1 if money < 0: while 1: pass assert money >= 0 for i in range(N): P[i] = min(P[i] + x, 60) if not DEBUG: print(2, x) total_total = 0 for loop in range(LOOP): if DEBUG: T, N, money = 52, 10, 2 * 10 ** 6 D = [random() + 0.5 for _ in range(N)] else: T, N, money = map(int, input().split()) D = [random() + 0.5 for _ in range(N)] total_sell_count = [0] * N MA = [1.5] * N MI = [0.5] * N P = [0] * N R = [0] * N for t in range(T): if (20 < t < 40 and money >= 2500000): Advertise(3) elif (0 < t < 35 and money >= 1250000): Advertise(2) elif 1 < t < 1 and money >= 600000: Advertise(1) elif t < 4 and money >= 6000000: Advertise(4) elif t < 4 and money >= 3000000: Advertise(3) else: Order() receive() if DEBUG: if LOOP == 1: print("-" * 20) print("t =", t) print("Money =", money) print("P =", P) print("R =", R) print("MI =", ["{:.2f}".format(a) for a in MI]) print("MA =", ["{:.2f}".format(a) for a in MA]) print("D =", ["{:.2f}".format(a) for a in D]) print("Total =", sum(total_sell_count), total_sell_count) if LOCAL: total_total += sum(total_sell_count) if LOCAL and 20 >= LOOP > 1: print("loop =", loop, total_sell_count, sum(total_sell_count), round(total_total / (loop + 1))) if LOCAL and LOOP > 1: print("LOOP =", LOOP, round(total_total / LOOP))