結果

問題 No.1416 ショッピングモール
ユーザー mesame3993mesame3993
提出日時 2021-12-09 01:32:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 1,000 ms
コード長 444 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 81,092 KB
最終ジャッジ日時 2023-09-23 12:44:06
合計ジャッジ時間 3,349 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,228 KB
testcase_01 AC 69 ms
71,148 KB
testcase_02 AC 69 ms
71,216 KB
testcase_03 AC 69 ms
71,484 KB
testcase_04 AC 69 ms
71,088 KB
testcase_05 AC 71 ms
71,416 KB
testcase_06 AC 75 ms
71,176 KB
testcase_07 AC 68 ms
70,996 KB
testcase_08 AC 71 ms
71,084 KB
testcase_09 AC 70 ms
71,128 KB
testcase_10 AC 71 ms
71,348 KB
testcase_11 AC 74 ms
75,816 KB
testcase_12 AC 70 ms
71,452 KB
testcase_13 AC 74 ms
75,728 KB
testcase_14 AC 75 ms
75,852 KB
testcase_15 AC 74 ms
75,892 KB
testcase_16 AC 75 ms
75,760 KB
testcase_17 AC 71 ms
76,068 KB
testcase_18 AC 75 ms
76,024 KB
testcase_19 AC 74 ms
76,000 KB
testcase_20 AC 76 ms
75,816 KB
testcase_21 AC 86 ms
80,400 KB
testcase_22 AC 86 ms
80,984 KB
testcase_23 AC 81 ms
81,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from sys import stdin
  readline = stdin.readline
  n = int(readline())
  A = list(map(int, readline().split()))
  A.sort(reverse=True)
  ans, k, now = 0, 0, 0
  for i in range(n):
    now += 1
    ans += A[i] * k
    if now == 2**k:
      k += 1
      now = 0
  print(ans)
  
if __name__ == "__main__":
  import sys
  readline = sys.stdin.readline
  def error(*args, end='\n'):
    print(*args, end=end, file=sys.stderr)
  main()
0