結果
問題 | No.1416 ショッピングモール |
ユーザー |
|
提出日時 | 2021-03-05 23:19:16 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 1,000 ms |
コード長 | 690 bytes |
コンパイル時間 | 2,387 ms |
コンパイル使用メモリ | 165,288 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-07 04:58:36 |
合計ジャッジ時間 | 3,271 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;#define int ll#define endl '\n'#define pii pair<int , int>#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)#define pb push_back#define pii pair<int , int>#define F first#define S second#define M_PI 3.14159265358979323846const int mod = 1000000007;const int MAXX = 1e6 + 5;int n;signed main(){_FastIO;cin >> n;vector<int> a(n);for(int i = 0; i < n; i++){cin >> a[i];}sort(a.rbegin() , a.rend());int ans = 0;for(int i = 0; i < n; i++){int k = log2(i + 1);ans += (k * a[i]);}cout << ans << endl;return 0;}