結果
| 問題 |
No.1416 ショッピングモール
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-05 22:54:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 1,000 ms |
| コード長 | 555 bytes |
| コンパイル時間 | 1,842 ms |
| コンパイル使用メモリ | 174,284 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-07 04:03:59 |
| 合計ジャッジ時間 | 2,724 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
using ll = long long;
int main () {
int n, f=0, cost=0;
cin >> n;
vector<int> a(n);
for (int i=0; i<n; i++){
cin >> a[i];
}
sort(a.rbegin(), a.rend());
for(int i=0; i<n; i++){
}
int I=0;
for (int i=0; i<n; i++){
if(I<pow(2, f)){
cost += a[i]*f;
I++;
}
else {
f++;
cost += a[i]*f;
I = 1;
}
}
cout << cost << endl;
}