結果

問題 No.1416 ショッピングモール
ユーザー chineristACchineristAC
提出日時 2021-03-05 21:45:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 1,000 ms
コード長 993 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 81,900 KB
実行使用メモリ 75,760 KB
最終ジャッジ日時 2024-04-16 09:10:48
合計ジャッジ時間 2,429 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
62,704 KB
testcase_01 AC 58 ms
62,812 KB
testcase_02 AC 54 ms
64,032 KB
testcase_03 AC 54 ms
62,860 KB
testcase_04 AC 53 ms
62,500 KB
testcase_05 AC 54 ms
63,216 KB
testcase_06 AC 52 ms
62,576 KB
testcase_07 AC 55 ms
62,644 KB
testcase_08 AC 56 ms
63,884 KB
testcase_09 AC 54 ms
62,524 KB
testcase_10 AC 54 ms
62,604 KB
testcase_11 AC 58 ms
66,072 KB
testcase_12 AC 54 ms
64,208 KB
testcase_13 AC 58 ms
65,232 KB
testcase_14 AC 59 ms
65,668 KB
testcase_15 AC 60 ms
67,164 KB
testcase_16 AC 58 ms
66,020 KB
testcase_17 AC 60 ms
66,716 KB
testcase_18 AC 60 ms
66,412 KB
testcase_19 AC 60 ms
65,912 KB
testcase_20 AC 58 ms
66,772 KB
testcase_21 AC 71 ms
73,592 KB
testcase_22 AC 74 ms
74,608 KB
testcase_23 AC 65 ms
75,760 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