結果
問題 | No.5018 Let's Make a Best-seller Book |
ユーザー | hirayuu_yc |
提出日時 | 2023-10-01 15:49:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 166 ms / 400 ms |
コード長 | 3,790 bytes |
コンパイル時間 | 293 ms |
コンパイル使用メモリ | 87,392 KB |
実行使用メモリ | 94,824 KB |
スコア | 96,870 |
平均クエリ数 | 52.00 |
最終ジャッジ日時 | 2023-10-01 15:49:33 |
合計ジャッジ時間 | 19,912 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 143 ms
94,716 KB |
testcase_01 | AC | 142 ms
93,744 KB |
testcase_02 | AC | 166 ms
94,388 KB |
testcase_03 | AC | 141 ms
94,324 KB |
testcase_04 | AC | 140 ms
94,040 KB |
testcase_05 | AC | 139 ms
94,516 KB |
testcase_06 | AC | 139 ms
94,112 KB |
testcase_07 | AC | 136 ms
94,480 KB |
testcase_08 | AC | 138 ms
94,088 KB |
testcase_09 | AC | 151 ms
94,528 KB |
testcase_10 | AC | 140 ms
94,320 KB |
testcase_11 | AC | 141 ms
94,440 KB |
testcase_12 | AC | 143 ms
94,628 KB |
testcase_13 | AC | 143 ms
94,540 KB |
testcase_14 | AC | 144 ms
94,168 KB |
testcase_15 | AC | 156 ms
94,088 KB |
testcase_16 | AC | 146 ms
94,520 KB |
testcase_17 | AC | 138 ms
94,336 KB |
testcase_18 | AC | 140 ms
94,452 KB |
testcase_19 | AC | 140 ms
94,388 KB |
testcase_20 | AC | 148 ms
94,236 KB |
testcase_21 | AC | 148 ms
94,204 KB |
testcase_22 | AC | 142 ms
94,064 KB |
testcase_23 | AC | 148 ms
94,480 KB |
testcase_24 | AC | 142 ms
94,600 KB |
testcase_25 | AC | 147 ms
93,808 KB |
testcase_26 | AC | 139 ms
94,532 KB |
testcase_27 | AC | 138 ms
94,264 KB |
testcase_28 | AC | 155 ms
94,600 KB |
testcase_29 | AC | 143 ms
94,104 KB |
testcase_30 | AC | 142 ms
94,420 KB |
testcase_31 | AC | 142 ms
94,700 KB |
testcase_32 | AC | 138 ms
94,704 KB |
testcase_33 | AC | 153 ms
94,404 KB |
testcase_34 | AC | 137 ms
94,536 KB |
testcase_35 | AC | 140 ms
93,860 KB |
testcase_36 | AC | 138 ms
94,496 KB |
testcase_37 | AC | 138 ms
94,492 KB |
testcase_38 | AC | 137 ms
93,940 KB |
testcase_39 | AC | 140 ms
94,008 KB |
testcase_40 | AC | 141 ms
94,472 KB |
testcase_41 | AC | 140 ms
94,764 KB |
testcase_42 | AC | 138 ms
94,624 KB |
testcase_43 | AC | 136 ms
94,208 KB |
testcase_44 | AC | 164 ms
93,904 KB |
testcase_45 | AC | 139 ms
94,220 KB |
testcase_46 | AC | 139 ms
94,056 KB |
testcase_47 | AC | 140 ms
94,044 KB |
testcase_48 | AC | 140 ms
94,460 KB |
testcase_49 | AC | 140 ms
94,372 KB |
testcase_50 | AC | 138 ms
94,492 KB |
testcase_51 | AC | 145 ms
94,320 KB |
testcase_52 | AC | 143 ms
93,728 KB |
testcase_53 | AC | 139 ms
94,152 KB |
testcase_54 | AC | 138 ms
94,572 KB |
testcase_55 | AC | 145 ms
94,124 KB |
testcase_56 | AC | 141 ms
94,396 KB |
testcase_57 | AC | 141 ms
94,200 KB |
testcase_58 | AC | 139 ms
94,364 KB |
testcase_59 | AC | 141 ms
94,092 KB |
testcase_60 | AC | 145 ms
94,316 KB |
testcase_61 | AC | 138 ms
94,116 KB |
testcase_62 | AC | 137 ms
93,992 KB |
testcase_63 | AC | 140 ms
93,868 KB |
testcase_64 | AC | 139 ms
94,092 KB |
testcase_65 | AC | 139 ms
94,304 KB |
testcase_66 | AC | 138 ms
94,540 KB |
testcase_67 | AC | 140 ms
94,252 KB |
testcase_68 | AC | 139 ms
94,132 KB |
testcase_69 | AC | 141 ms
94,384 KB |
testcase_70 | AC | 138 ms
94,240 KB |
testcase_71 | AC | 137 ms
94,216 KB |
testcase_72 | AC | 137 ms
94,124 KB |
testcase_73 | AC | 139 ms
93,868 KB |
testcase_74 | AC | 141 ms
94,048 KB |
testcase_75 | AC | 140 ms
94,728 KB |
testcase_76 | AC | 148 ms
94,456 KB |
testcase_77 | AC | 138 ms
94,784 KB |
testcase_78 | AC | 137 ms
94,276 KB |
testcase_79 | AC | 141 ms
94,440 KB |
testcase_80 | AC | 142 ms
94,560 KB |
testcase_81 | AC | 154 ms
94,352 KB |
testcase_82 | AC | 141 ms
93,952 KB |
testcase_83 | AC | 139 ms
93,724 KB |
testcase_84 | AC | 140 ms
93,724 KB |
testcase_85 | AC | 138 ms
93,760 KB |
testcase_86 | AC | 137 ms
94,824 KB |
testcase_87 | AC | 147 ms
94,428 KB |
testcase_88 | AC | 137 ms
94,548 KB |
testcase_89 | AC | 137 ms
94,168 KB |
testcase_90 | AC | 138 ms
94,044 KB |
testcase_91 | AC | 139 ms
93,832 KB |
testcase_92 | AC | 139 ms
94,048 KB |
testcase_93 | AC | 140 ms
94,024 KB |
testcase_94 | AC | 141 ms
94,688 KB |
testcase_95 | AC | 140 ms
93,892 KB |
testcase_96 | AC | 139 ms
93,760 KB |
testcase_97 | AC | 138 ms
94,216 KB |
testcase_98 | AC | 148 ms
94,060 KB |
testcase_99 | AC | 143 ms
94,032 KB |
ソースコード
import random import sys input_count=0 def standing(): #"""提出時はコメントアウトを解除 return map(int,input().split()) #""" ret=tuple(map(int,input().split()))+(2000000,) for i in range(10): D[i]=float(input()) return ret def sell(L): global money,S,P,R,score #"""提出時はコメントアウトを解除 print(1,*L,flush=True) money=int(input()) assert money>=0 S=list(map(int,input().split())) P=list(map(int,input().split())) R=list(map(int,input().split())) return money,S,P,R #""" print(1,*L) Z=list(map(float,input().split())) for i in range(10): R[i]+=L[i] S[i]=int(min(R[i],(R[i]**0.5)*(1.05**P[i])*D[i]*Z[i])) score+=S[i] money-=L[i]*500 money+=S[i]*1000 if R[i]!=0: if S[i]<0.1*R[i]: P[i]-=1 if S[i]>=0.3*R[i]: P[i]+=1 P[i]=max(-60,min(P[i],60)) R[i]-=S[i] assert score>=0 return money,S,P,R def adv(x): global money,S,P,R,score #"""提出時はコメントアウトを解除 print(2,x,flush=True) money=int(input()) assert money>=0 S=list(map(int,input().split())) P=list(map(int,input().split())) R=list(map(int,input().split())) return money,S,P,R #""" print(2,x) Z=list(map(float,input().split())) for i in range(10): P[i]=max(-60,min(P[i]+x,60)) money-=pow(2,x-1)*500000 for i in range(10): S[i]=int(min(R[i],(R[i]**0.5)*(1.05**P[i])*D[i]*Z[i])) score+=S[i] money+=S[i]*1000 if R[i]!=0: if S[i]<0.1*R[i]: P[i]-=1 if S[i]>=0.3*R[i]: P[i]+=1 P[i]=max(-60,min(P[i],60)) R[i]-=S[i] assert score>=0 return money,S,P,R def calc(): global add global count for i in range(10): if R[i]+L[i]!=0: add[i]+=S[i]/(((R[i]+L[i])**0.5)*(1.05**P[i])) count[i]+=1 pre=5 score=0 ad=41 D=[1]*10 T,N,money=standing() S=[0 for i in range(N)] P=[0 for i in range(N)] R=[0 for i in range(N)] add=[0 for i in range(N)] count=[0 for i in range(N)] bef=set(range(10)) cnt=0 money,S,P,R=adv(2) for i in range(pre): L=[0]*N for j in range(10): lf=1 ri=998244353 while ri-lf>1: mid=(lf+ri)//2 if (mid**0.5)*(10/3)*(1.05**P[j])*0.5>=mid: lf=mid else: ri=mid L[j]=lf-R[j] if P[j]<i+2: L[j]=0 money,S,rP,rR=sell(L) calc() P=rP[:] R=rR[:] now=set() for j in range(10): if P[j]>=i+2 and j in bef: now.add(j) if now==bef and now!=set(range(10)): cnt+=1 if cnt==3: pre=i+1 break else: cnt=0 bef=now ad=40-pre use=set() for i in range(10): if P[i]>=pre+1: use.add(i) if len(use)==0: for i in range(10): if P[i]==max(P): use.add(i) for i in range(ad): if money>1000000: money,S,P,R=adv(2) else: L=[0]*N for j in use: lf=1 ri=998244353 while ri-lf>1: mid=(lf+ri)//2 if (mid**0.5)*(10/3)*(1.05**P[j])*(add[j]/count[j])*0.7>=mid: lf=mid else: ri=mid L[j]=max(0,min((money//500)//len(use),lf-R[j])) money,S,rP,rR=sell(L) calc() P=rP[:] R=rR[:] for i in range(T-ad-pre-1): L=[0]*N plus=0 for j in use: plus+=add[j]**2 for j in use: L[j]=int((money//500)*(add[j]**2)//plus) money,S,rP,rR=sell(L) calc() P=rP[:] R=rR[:] print(score,file=sys.stderr)