結果
| 問題 | No.1416 ショッピングモール |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-28 23:21:27 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 1,000 ms |
| コード長 | 444 bytes |
| 記録 | |
| コンパイル時間 | 1,210 ms |
| コンパイル使用メモリ | 186,820 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-23 05:48:29 |
| 合計ジャッジ時間 | 2,714 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long n,sum=0,two=2,step=2,step_n=1;
cin>>n;
vector<int> a(n);
for(int i=0; i<n; ++i) cin>>a.at(i);
sort(a.rbegin(),a.rend());
for(int i=1; i<n; ++i){
if(i>step){
two*=2;
step+=two;
step_n++;
}
sum+=step_n*a.at(i);
}
cout<<sum<<"\n";
}