結果
問題 |
No.1416 ショッピングモール
|
ユーザー |
|
提出日時 | 2021-05-22 18:50:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 1,000 ms |
コード長 | 389 bytes |
コンパイル時間 | 1,645 ms |
コンパイル使用メモリ | 171,060 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-10 17:15:04 |
合計ジャッジ時間 | 2,572 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < (n); i++) #define P pair<int, int> int main() { int n; cin >> n; vector<int> a(n); rep(i,n) cin >> a[i]; sort(a.begin(), a.end(), greater<int>()); int f = 0; int ans = 0; rep(i,n) { if (i >= (1 << (f+1))-1) f++; ans += a[i]*f; } cout << ans << endl; }