結果
問題 |
No.1416 ショッピングモール
|
ユーザー |
![]() |
提出日時 | 2021-09-18 15:09:13 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 57 ms / 1,000 ms |
コード長 | 357 bytes |
コンパイル時間 | 224 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 69,460 KB |
最終ジャッジ日時 | 2024-06-30 12:36:20 |
合計ジャッジ時間 | 2,525 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
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)