結果
問題 |
No.1416 ショッピングモール
|
ユーザー |
|
提出日時 | 2021-03-28 23:21:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 1,000 ms |
コード長 | 444 bytes |
コンパイル時間 | 1,920 ms |
コンパイル使用メモリ | 172,376 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 09:31:08 |
合計ジャッジ時間 | 3,122 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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"; }