結果
問題 | No.2495 Three Sets |
ユーザー | mymelochan |
提出日時 | 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 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2,747 ms
78,336 KB |
testcase_01 | AC | 2,749 ms
78,080 KB |
testcase_02 | AC | 2,749 ms
78,208 KB |
testcase_03 | AC | 2,749 ms
78,080 KB |
testcase_04 | AC | 2,748 ms
78,336 KB |
testcase_05 | AC | 2,749 ms
78,464 KB |
testcase_06 | AC | 2,749 ms
78,440 KB |
testcase_07 | AC | 2,749 ms
77,924 KB |
testcase_08 | AC | 2,748 ms
78,720 KB |
testcase_09 | AC | 2,750 ms
78,184 KB |
testcase_10 | AC | 2,753 ms
78,624 KB |
testcase_11 | AC | 2,753 ms
78,424 KB |
testcase_12 | AC | 2,754 ms
79,232 KB |
testcase_13 | AC | 2,796 ms
88,520 KB |
testcase_14 | AC | 2,830 ms
101,632 KB |
testcase_15 | AC | 2,806 ms
92,520 KB |
testcase_16 | AC | 2,873 ms
124,112 KB |
testcase_17 | AC | 2,873 ms
123,904 KB |
testcase_18 | AC | 2,749 ms
78,848 KB |
testcase_19 | AC | 2,822 ms
124,160 KB |
testcase_20 | AC | 2,828 ms
122,816 KB |
ソースコード
############################################################# 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)/TL 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)