結果
| 問題 |
No.2495 Three Sets
|
| ユーザー |
mymelochan
|
| 提出日時 | 2023-10-06 22:10:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,041 bytes |
| コンパイル時間 | 301 ms |
| コンパイル使用メモリ | 82,372 KB |
| 実行使用メモリ | 124,252 KB |
| 最終ジャッジ日時 | 2024-07-26 16:23:30 |
| 合計ジャッジ時間 | 68,796 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 3 |
| other | TLE * 18 |
ソースコード
#############################################################
import sys
sys.setrecursionlimit(10**7)
from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations
ipt = sys.stdin.readline
def iin():
return int(ipt())
def lmin():
return list(map(int,ipt().split()))
import random
import time
from math import exp
TL = 0.3
T0,T1 = 10000,1
MOD = 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]*i
ans = 0
while time.time() - start_time + TL <= 2.98:
ca,cb,cc = random.randrange(NA),random.randrange(NB),random.randrange(NC)
cur_time = 0
cnt = 0
score = calc_score(ca,cb,cc)
tmp_start_time = time.time()
while True:
if cnt%100 == 0:
cur_time = time.time()-tmp_start_time
if cur_time >= 1.0:
break
idx = random.randrange(6)
da,db,dc = d[idx]
na,nb,nc = da+ca,db+cb,dc+cc
if na < 0 or na > NA or nb < 0 or nb > NB or nc < 0 or nc > NC:
continue
new_score = calc_score(na,nb,nc)
d_score = new_score-score
temp = T0**(1-cur_time)*T1**cur_time
v = d_score/temp
v = min(v,1.01)
v = max(v,-20)
if cur_time >= 0.95:
if v >= 0:
ca,cb,cc = na,nb,nc
score = new_score
else:
if exp(v) > random.random():
ca,cb,cc = na,nb,nc
score = new_score
ans = max(ans,score)
print(ans)
mymelochan