結果

問題 No.1416 ショッピングモール
ユーザー HAGI_TAROHAGI_TARO
提出日時 2021-09-18 15:09:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 1,000 ms
コード長 357 bytes
コンパイル時間 1,308 ms
コンパイル使用メモリ 86,760 KB
実行使用メモリ 82,088 KB
最終ジャッジ日時 2023-09-13 01:54:04
合計ジャッジ時間 5,024 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,404 KB
testcase_01 AC 71 ms
71,328 KB
testcase_02 AC 71 ms
71,216 KB
testcase_03 AC 72 ms
71,260 KB
testcase_04 AC 73 ms
71,300 KB
testcase_05 AC 71 ms
71,212 KB
testcase_06 AC 71 ms
71,324 KB
testcase_07 AC 72 ms
71,420 KB
testcase_08 AC 70 ms
70,904 KB
testcase_09 AC 70 ms
71,252 KB
testcase_10 AC 71 ms
71,144 KB
testcase_11 AC 79 ms
76,168 KB
testcase_12 AC 73 ms
71,196 KB
testcase_13 AC 76 ms
76,272 KB
testcase_14 AC 76 ms
76,332 KB
testcase_15 AC 78 ms
76,228 KB
testcase_16 AC 75 ms
75,996 KB
testcase_17 AC 77 ms
76,228 KB
testcase_18 AC 78 ms
76,312 KB
testcase_19 AC 78 ms
76,056 KB
testcase_20 AC 78 ms
76,256 KB
testcase_21 AC 89 ms
81,328 KB
testcase_22 AC 90 ms
82,088 KB
testcase_23 AC 84 ms
82,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = sorted(list(map(int,input().split())),reverse=True)
i = 0
cnt = 0
ans = 0
while True:
    if n - 2 ** i >= 0:
        for j in range(2 ** i):
            ans += i * A[cnt]
            cnt += 1
        n -= 2 ** i
    else:
        for j in range(n):
            ans += i * A[cnt]
            cnt += 1
        break
    i += 1
print(ans)
0