結果

問題 No.1416 ショッピングモール
ユーザー mesame3993
提出日時 2021-12-09 01:32:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 60 ms / 1,000 ms
コード長 444 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,000 KB
実行使用メモリ 68,736 KB
最終ジャッジ日時 2024-07-16 12:21:12
合計ジャッジ時間 2,167 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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