結果

問題 No.1416 ショッピングモール
ユーザー 沙耶花沙耶花
提出日時 2021-03-05 21:26:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 20 ms / 1,000 ms
コード長 492 bytes
コンパイル時間 5,506 ms
コンパイル使用メモリ 252,000 KB
最終ジャッジ日時 2025-01-19 10:35:26
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001

int main(){
	
	int n;
	cin>>n;
	
	vector<long long> a(n);
	rep(i,n){
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	
	long long ans = 0LL;
	
	rep(i,16){
		rep(j,1<<i){
			if(a.size()==0)continue;
			ans += a.back() * i;
			a.pop_back();
		}
	}
	
	cout<<ans<<endl;
	
    return 0;
}
0