結果
問題 | No.5018 Let's Make a Best-seller Book |
ユーザー | ra5anchor |
提出日時 | 2024-10-04 08:13:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 146 ms / 400 ms |
コード長 | 3,921 bytes |
コンパイル時間 | 324 ms |
コンパイル使用メモリ | 82,364 KB |
実行使用メモリ | 96,872 KB |
スコア | 11,379 |
平均クエリ数 | 52.00 |
最終ジャッジ日時 | 2024-10-04 08:14:08 |
合計ジャッジ時間 | 17,554 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 123 ms
96,512 KB |
testcase_01 | AC | 137 ms
96,872 KB |
testcase_02 | AC | 130 ms
95,944 KB |
testcase_03 | AC | 126 ms
96,528 KB |
testcase_04 | AC | 125 ms
96,080 KB |
testcase_05 | AC | 136 ms
96,076 KB |
testcase_06 | AC | 123 ms
96,312 KB |
testcase_07 | AC | 123 ms
96,552 KB |
testcase_08 | AC | 122 ms
96,524 KB |
testcase_09 | AC | 127 ms
96,152 KB |
testcase_10 | AC | 122 ms
95,884 KB |
testcase_11 | AC | 123 ms
96,096 KB |
testcase_12 | AC | 123 ms
96,504 KB |
testcase_13 | AC | 121 ms
96,536 KB |
testcase_14 | AC | 131 ms
96,176 KB |
testcase_15 | AC | 130 ms
96,132 KB |
testcase_16 | AC | 125 ms
96,408 KB |
testcase_17 | AC | 121 ms
96,608 KB |
testcase_18 | AC | 123 ms
96,628 KB |
testcase_19 | AC | 121 ms
96,568 KB |
testcase_20 | AC | 133 ms
96,244 KB |
testcase_21 | AC | 121 ms
96,176 KB |
testcase_22 | AC | 129 ms
96,440 KB |
testcase_23 | AC | 124 ms
96,596 KB |
testcase_24 | AC | 120 ms
96,200 KB |
testcase_25 | AC | 126 ms
96,576 KB |
testcase_26 | AC | 118 ms
96,232 KB |
testcase_27 | AC | 121 ms
96,552 KB |
testcase_28 | AC | 137 ms
96,572 KB |
testcase_29 | AC | 137 ms
96,208 KB |
testcase_30 | AC | 119 ms
96,468 KB |
testcase_31 | AC | 124 ms
96,144 KB |
testcase_32 | AC | 121 ms
96,588 KB |
testcase_33 | AC | 126 ms
96,528 KB |
testcase_34 | AC | 129 ms
95,940 KB |
testcase_35 | AC | 132 ms
96,380 KB |
testcase_36 | AC | 126 ms
96,280 KB |
testcase_37 | AC | 122 ms
96,564 KB |
testcase_38 | AC | 118 ms
96,472 KB |
testcase_39 | AC | 126 ms
96,544 KB |
testcase_40 | AC | 129 ms
96,596 KB |
testcase_41 | AC | 120 ms
96,128 KB |
testcase_42 | AC | 118 ms
96,560 KB |
testcase_43 | AC | 129 ms
96,212 KB |
testcase_44 | AC | 125 ms
96,200 KB |
testcase_45 | AC | 117 ms
96,496 KB |
testcase_46 | AC | 131 ms
96,448 KB |
testcase_47 | AC | 124 ms
96,084 KB |
testcase_48 | AC | 118 ms
96,504 KB |
testcase_49 | AC | 117 ms
96,552 KB |
testcase_50 | AC | 120 ms
96,056 KB |
testcase_51 | AC | 143 ms
96,372 KB |
testcase_52 | AC | 122 ms
96,388 KB |
testcase_53 | AC | 124 ms
96,760 KB |
testcase_54 | AC | 121 ms
96,100 KB |
testcase_55 | AC | 118 ms
96,752 KB |
testcase_56 | AC | 120 ms
96,344 KB |
testcase_57 | AC | 119 ms
96,348 KB |
testcase_58 | AC | 121 ms
96,868 KB |
testcase_59 | AC | 120 ms
96,324 KB |
testcase_60 | AC | 124 ms
96,312 KB |
testcase_61 | AC | 121 ms
96,028 KB |
testcase_62 | AC | 130 ms
96,392 KB |
testcase_63 | AC | 135 ms
95,948 KB |
testcase_64 | AC | 133 ms
96,400 KB |
testcase_65 | AC | 120 ms
96,332 KB |
testcase_66 | AC | 146 ms
96,260 KB |
testcase_67 | AC | 125 ms
96,376 KB |
testcase_68 | AC | 126 ms
96,568 KB |
testcase_69 | AC | 124 ms
96,112 KB |
testcase_70 | AC | 127 ms
96,444 KB |
testcase_71 | AC | 124 ms
96,608 KB |
testcase_72 | AC | 124 ms
96,232 KB |
testcase_73 | AC | 122 ms
96,500 KB |
testcase_74 | AC | 129 ms
96,148 KB |
testcase_75 | AC | 124 ms
96,308 KB |
testcase_76 | AC | 128 ms
96,556 KB |
testcase_77 | AC | 123 ms
96,120 KB |
testcase_78 | AC | 122 ms
96,144 KB |
testcase_79 | AC | 122 ms
96,808 KB |
testcase_80 | AC | 127 ms
96,488 KB |
testcase_81 | AC | 139 ms
96,008 KB |
testcase_82 | AC | 129 ms
96,080 KB |
testcase_83 | AC | 124 ms
96,184 KB |
testcase_84 | AC | 121 ms
96,064 KB |
testcase_85 | AC | 124 ms
96,268 KB |
testcase_86 | AC | 120 ms
96,148 KB |
testcase_87 | AC | 127 ms
96,352 KB |
testcase_88 | AC | 133 ms
96,044 KB |
testcase_89 | AC | 136 ms
96,532 KB |
testcase_90 | AC | 123 ms
96,016 KB |
testcase_91 | AC | 122 ms
96,364 KB |
testcase_92 | AC | 122 ms
96,328 KB |
testcase_93 | AC | 126 ms
96,792 KB |
testcase_94 | AC | 130 ms
96,052 KB |
testcase_95 | AC | 136 ms
96,376 KB |
testcase_96 | AC | 137 ms
96,548 KB |
testcase_97 | AC | 121 ms
96,236 KB |
testcase_98 | AC | 125 ms
96,576 KB |
testcase_99 | AC | 133 ms
96,500 KB |
ソースコード
import copy import random from time import perf_counter import argparse import sys import math class TimeKeeper: def __init__(self): self.start_time = perf_counter() def is_time_over(self, LIMIT): return (perf_counter() - self.start_time) >= LIMIT def time_now(self): return (perf_counter() - self.start_time) ########################################### def main(DEBUG): tk = TimeKeeper() if DEBUG == True: LIMIT = 0.3 else: LIMIT = 0.3 Lin = list(map(int, input().split())) T = Lin[0] N = Lin[1] money = 2000000 # T = 52 ターン # N = 10 店の数 if DEBUG: # 隠しデータ D = [] # 売れやすさ 0.5 <= d <1.5 for i in range(N): d = float(input()) D.append(d) Z = [] # 0.75 < z < 1.25 for i in range(T): z = list(map(float, input().split())) Z.append(z) p_book0 = 500 # 本の原価 p_adv = 500000 # 広告の単価 p_book1 = 1000 # 本の販売価格 Stot = 0 # 売上冊数 # 初期値 S = [0] * N P = [0] * N R = [0] * N prev = 0 # インタラクティブ for week in range(T): print(f'=== WEEK === {week}', file=sys.stderr) # (あ) 出版社の行動を出力する x = 0 L = [0]*N Lprev = [0]*N # 広告をうつ if money > p_adv * 2: x = 1 cost = p_adv while cost < money//2: x += 1 cost = p_adv * 2**(x-1) print("2", x, flush=True) print("adv book", x, file=sys.stderr) cost = p_adv * 2**(x-1) prev = 2 for i in range(N): Lprev[i] = max(0, S[i] * 3 - R[i]) # 1:本を発送 else: remainL = money // p_book0 for i in range(N): if S[i] == 0 and R[i] == 0: L[i] = min(1, remainL) remainL -= L[i] else: # L[i] = max(0, S[i] * 3 - R[i]) if prev == 2: L[i] = min(Lprev[i], remainL) remainL -= L[i] else: L[i] = min(max(0, S[i] * 3 - R[i]), remainL) remainL -= L[i] print("1", *L, flush=True) print("send book", L, file=sys.stderr) cost = sum(L) * p_book0 prev = 1 # (い) 売上部数などを入力する if DEBUG == False: money = int(input()) # 所持金 S = list(map(int, input().split())) # 各書店でこの週に売れた部数 P = list(map(int, input().split())) # 各書店での人気度 R = list(map(int, input().split())) # 各書店での在庫数 else: money -= cost for i in range(N): P[i] = max(-60, min(60, P[i]+x)) R[i] += L[i] S[i] = int(min(R[i], (R[i]**0.5) * (1.05 ** P[i]) * D[i] * Z[week][i])) money += S[i] * p_book1 Stot += S[i] if R[i] != 0 and S[i] >= 0.3 * R[i]: P[i] = min(60, P[i]+1) elif R[i] != 0 and S[i] < 0.1 * R[i]: P[i] = max(-60, P[i]-1) R[i] -= S[i] print(f"Stot: {Stot}", file=sys.stderr) print(f"money: {money:,}", file=sys.stderr) print(f"sell: {S}", file=sys.stderr) print(f"popular: {P}", file=sys.stderr) print(f"remain: {R}", file=sys.stderr) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Debug mode') parser.add_argument('--debug', action='store_true', help='Enable debug mode') args = parser.parse_args() main(args.debug)