結果
| 問題 | No.1416 ショッピングモール | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-03-05 21:33:14 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 17 ms / 1,000 ms | 
| コード長 | 1,200 bytes | 
| コンパイル時間 | 788 ms | 
| コンパイル使用メモリ | 83,276 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-07 00:42:30 | 
| 合計ジャッジ時間 | 1,414 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
//#include <bits/stdc++.h>>
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <bitset>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pt(sth) cout << sth << "\n"
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
typedef long long ll;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;
//static const ll MOD=998244353;
//for(i=0;i<N;i++) cin>>a[i];
typedef vector<vector<vector<ll>>> v3D;
typedef vector<vector<ll>> v2D;
typedef vector<ll> v1D;
int main(void) {
  ll i, j, k;
  
  ll N;cin>>N;
  priority_queue<ll> q;
  for(i=0;i<N;i++){
    ll a;cin>>a;
    q.push(a);
  }
  
  ll ans=0;
  for(i=0;i<20;i++){
    ll t=1<<i;
    while(t--){
      if(q.size()==0){
        pt(ans);
        return 0;
      }
      
      ans+=q.top()*i;
      q.pop();
    }
    
    
    
  }
  
  
  
  
  
  
}
            
            
            
        