結果

問題 No.1416 ショッピングモール
ユーザー mesame3993mesame3993
提出日時 2021-12-09 01:30:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 553 bytes
コンパイル時間 2,037 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 83,804 KB
最終ジャッジ日時 2023-09-23 12:42:50
合計ジャッジ時間 4,474 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,452 KB
testcase_01 AC 73 ms
71,436 KB
testcase_02 AC 74 ms
71,308 KB
testcase_03 AC 75 ms
71,332 KB
testcase_04 AC 72 ms
71,428 KB
testcase_05 AC 82 ms
75,616 KB
testcase_06 AC 75 ms
71,248 KB
testcase_07 AC 82 ms
75,460 KB
testcase_08 AC 91 ms
76,256 KB
testcase_09 AC 74 ms
71,100 KB
testcase_10 AC 74 ms
71,500 KB
testcase_11 AC 103 ms
77,792 KB
testcase_12 AC 81 ms
75,540 KB
testcase_13 AC 99 ms
77,828 KB
testcase_14 AC 99 ms
77,556 KB
testcase_15 AC 103 ms
77,756 KB
testcase_16 AC 101 ms
77,736 KB
testcase_17 AC 102 ms
77,704 KB
testcase_18 AC 102 ms
77,752 KB
testcase_19 AC 105 ms
77,760 KB
testcase_20 AC 102 ms
77,872 KB
testcase_21 AC 130 ms
83,020 KB
testcase_22 AC 132 ms
83,712 KB
testcase_23 AC 129 ms
83,804 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
    error(i, k)
    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