結果

問題 No.1416 ショッピングモール
ユーザー mesame3993mesame3993
提出日時 2021-12-09 01:30:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 1,000 ms
コード長 537 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 81,144 KB
最終ジャッジ日時 2023-09-23 12:43:02
合計ジャッジ時間 4,033 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,212 KB
testcase_01 AC 71 ms
71,380 KB
testcase_02 AC 71 ms
71,140 KB
testcase_03 AC 71 ms
71,300 KB
testcase_04 AC 72 ms
71,484 KB
testcase_05 AC 69 ms
71,384 KB
testcase_06 AC 70 ms
71,224 KB
testcase_07 AC 70 ms
71,240 KB
testcase_08 AC 71 ms
71,004 KB
testcase_09 AC 69 ms
71,316 KB
testcase_10 AC 71 ms
71,140 KB
testcase_11 AC 75 ms
76,004 KB
testcase_12 AC 69 ms
71,008 KB
testcase_13 AC 75 ms
75,828 KB
testcase_14 AC 74 ms
75,884 KB
testcase_15 AC 76 ms
75,852 KB
testcase_16 AC 74 ms
75,780 KB
testcase_17 AC 74 ms
75,980 KB
testcase_18 AC 79 ms
76,008 KB
testcase_19 AC 76 ms
75,808 KB
testcase_20 AC 76 ms
75,840 KB
testcase_21 AC 87 ms
80,644 KB
testcase_22 AC 89 ms
81,144 KB
testcase_23 AC 84 ms
81,108 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 = 0
  def keta(x):
    ret = 0
    while x > 0:
      ret += 1
      x //= 2
    return ret
  k = 0
  now = 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