結果

問題 No.1416 ショッピングモール
ユーザー O2MTO2MT
提出日時 2021-03-06 20:27:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 223 ms / 1,000 ms
コード長 249 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 222,208 KB
最終ジャッジ日時 2024-04-17 07:45:37
合計ジャッジ時間 2,782 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
51,456 KB
testcase_01 AC 41 ms
51,840 KB
testcase_02 AC 41 ms
51,712 KB
testcase_03 AC 45 ms
51,840 KB
testcase_04 AC 43 ms
51,840 KB
testcase_05 AC 41 ms
51,968 KB
testcase_06 AC 42 ms
51,712 KB
testcase_07 AC 43 ms
51,968 KB
testcase_08 AC 43 ms
52,736 KB
testcase_09 AC 40 ms
51,968 KB
testcase_10 AC 41 ms
51,968 KB
testcase_11 AC 54 ms
61,824 KB
testcase_12 AC 42 ms
51,968 KB
testcase_13 AC 55 ms
61,952 KB
testcase_14 AC 52 ms
62,464 KB
testcase_15 AC 54 ms
65,536 KB
testcase_16 AC 53 ms
62,464 KB
testcase_17 AC 58 ms
66,944 KB
testcase_18 AC 60 ms
66,560 KB
testcase_19 AC 61 ms
67,584 KB
testcase_20 AC 58 ms
66,816 KB
testcase_21 AC 203 ms
199,680 KB
testcase_22 AC 206 ms
199,680 KB
testcase_23 AC 223 ms
222,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
S = [2**k for k in range(N+1)]
A.sort(reverse=True)
i,j,ans = 0,0,0
for s in S:
    cnt = 0
    while cnt < s and j < N:
        ans += i*A[j]
        j += 1
        cnt += 1
    i += 1

print(ans)
0