結果
問題 | No.2495 Three Sets |
ユーザー |
![]() |
提出日時 | 2023-10-06 22:11:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,873 ms / 3,000 ms |
コード長 | 2,046 bytes |
コンパイル時間 | 260 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 124,160 KB |
最終ジャッジ日時 | 2024-07-26 16:25:15 |
合計ジャッジ時間 | 62,234 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#############################################################import syssys.setrecursionlimit(10**7)from heapq import heappop,heappushfrom collections import deque,defaultdict,Counterfrom bisect import bisect_left, bisect_rightfrom itertools import product,combinations,permutationsipt = sys.stdin.readlinedef iin():return int(ipt())def lmin():return list(map(int,ipt().split()))import randomimport timefrom math import expTL = 0.3T0,T1 = 10000,1MOD = 998244353#############################################################start_time = time.time()NA,NB,NC = lmin()A = lmin()B = lmin()C = lmin()A.sort(reverse=True)B.sort(reverse=True)C.sort(reverse=True)SA = [0]SB = [0]SC = [0]for a in A:SA.append(SA[-1]+a)for b in B:SB.append(SB[-1]+b)for c in C:SC.append(SC[-1]+c)d = [(1,0,0),(-1,0,0),(0,1,0),(0,-1,0),(0,0,1),(0,0,-1)]def calc_score(i,j,k):return SA[i]*j+SB[j]*k+SC[k]*ians = 0while time.time() - start_time + TL <= 2.98:ca,cb,cc = random.randrange(NA),random.randrange(NB),random.randrange(NC)cur_time = 0cnt = 0score = calc_score(ca,cb,cc)tmp_start_time = time.time()while True:if cnt%100 == 0:cur_time = (time.time()-tmp_start_time)/TLif cur_time >= 1.0:breakidx = random.randrange(6)da,db,dc = d[idx]na,nb,nc = da+ca,db+cb,dc+ccif na < 0 or na > NA or nb < 0 or nb > NB or nc < 0 or nc > NC:continuenew_score = calc_score(na,nb,nc)d_score = new_score-scoretemp = T0**(1-cur_time)*T1**cur_timev = d_score/tempv = min(v,1.01)v = max(v,-20)if cur_time >= 0.95:if v >= 0:ca,cb,cc = na,nb,ncscore = new_scoreelse:if exp(v) > random.random():ca,cb,cc = na,nb,ncscore = new_scoreans = max(ans,score)print(ans)