結果

問題 No.1416 ショッピングモール
ユーザー chineristACchineristAC
提出日時 2021-03-05 21:45:05
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 130 ms / 1,000 ms
コード長 993 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 84,556 KB
最終ジャッジ日時 2023-07-29 01:25:18
合計ジャッジ時間 4,430 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
78,260 KB
testcase_01 AC 114 ms
78,220 KB
testcase_02 AC 121 ms
78,268 KB
testcase_03 AC 116 ms
78,352 KB
testcase_04 AC 113 ms
78,544 KB
testcase_05 AC 115 ms
78,124 KB
testcase_06 AC 113 ms
78,260 KB
testcase_07 AC 114 ms
78,120 KB
testcase_08 AC 115 ms
78,280 KB
testcase_09 AC 115 ms
78,276 KB
testcase_10 AC 113 ms
78,360 KB
testcase_11 AC 118 ms
79,068 KB
testcase_12 AC 116 ms
78,400 KB
testcase_13 AC 117 ms
79,024 KB
testcase_14 AC 117 ms
79,004 KB
testcase_15 AC 120 ms
78,748 KB
testcase_16 AC 120 ms
78,920 KB
testcase_17 AC 120 ms
79,064 KB
testcase_18 AC 120 ms
78,948 KB
testcase_19 AC 121 ms
78,920 KB
testcase_20 AC 119 ms
78,756 KB
testcase_21 AC 128 ms
83,620 KB
testcase_22 AC 130 ms
84,192 KB
testcase_23 AC 126 ms
84,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def cmb(n, r, mod):#コンビネーションの高速計算 
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return (g1[n] * g2[r] % mod) * g2[n-r] % mod

mod = 998244353#出力の制限
N = 2*10**3
g1 = [1]*(N+1) # 元テーブル
g2 = [1]*(N+1) #逆元テーブル
inverse = [1]*(N+1) #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1[i]=( ( g1[i-1] * i ) % mod )
    inverse[i]=( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2[i]=( (g2[i-1] * inverse[i]) % mod )
inverse[0]=0

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import log,gcd

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

n = int(input())
A = li()
A.sort(reverse=True)

k = 0
cnt = 0
res = 0
for i in range(n):
    if cnt==pow(2,k):
        k += 1
        cnt = 0
    res += k * A[i]
    cnt += 1

print(res)
0