結果

問題 No.5018 Let's Make a Best-seller Book
ユーザー Kiri8128Kiri8128
提出日時 2023-10-01 15:16:31
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 2,995 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,356 KB
実行使用メモリ 98,996 KB
スコア 5,243
平均クエリ数 37.92
最終ジャッジ日時 2023-10-01 15:16:58
合計ジャッジ時間 26,347 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from random import gauss, random, randrange
DEBUG = 0
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)
        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)
    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])
    
    if DEBUG:
        for i in range(N):
            R[i] -= sell_count[i]
    else:
        P = [int(a) for a in input().split()]
        R = [int(a) for a in input().split()]
    
    for i in range(N):
        total_sell_count[i] += sell_count[i]
    
def Order():
    global P
    global R
    global money
    target = 10
    buy_count = [0] * N
    for i in range(N):
        if t < 5:
            target = max(1, int(100 / 9 * 1.05 ** P[i] * MI[i] / 10)) * 10
        elif t < 20:
            target = max(1, int(100 / 9 * 1.05 ** P[i] * MI[i] / 10)) * 10
        elif t < 30:
            target = max(1, int(100 / 9 * 1.05 ** P[i] * MI[i] / 10)) * 10
        else:
            target = max(1, int(100 / 0.8 * 1.05 ** P[i] * MI[i] / 10)) * 10
        buy_count[i] = 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
    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
    assert money >= 0
    for i in range(N):
        P[i] += x
    if not DEBUG:
        print(2, x)

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 t == 0 or (t < 30 and money >= 1500000):
        Advertise(2)
    else:
        Order()
    receive()
    if DEBUG:
        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)
0