結果
問題 | No.1416 ショッピングモール |
ユーザー |
|
提出日時 | 2021-03-06 00:35:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 1,000 ms |
コード長 | 276 bytes |
コンパイル時間 | 1,767 ms |
コンパイル使用メモリ | 171,192 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-07 07:09:18 |
合計ジャッジ時間 | 2,673 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include<bits/stdc++.h>using namespace std;int main(){int n;cin>>n;vector<int>a(n);for(int &i:a)cin>>i;sort(a.begin(),a.end());int64_t ans=0,k=0;while(n){for(int i=0;i<(1<<k)&&n>0;i++){ans+=a[--n]*k;}k++;}cout<<ans<<'\n';}