結果
| 問題 | No.1416 ショッピングモール |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-05 22:54:11 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 1,000 ms |
| コード長 | 555 bytes |
| 記録 | |
| コンパイル時間 | 1,013 ms |
| コンパイル使用メモリ | 186,728 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-23 20:06:53 |
| 合計ジャッジ時間 | 1,926 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}