結果
| 問題 |
No.1416 ショッピングモール
|
| コンテスト | |
| ユーザー |
m_tsubasa
|
| 提出日時 | 2021-03-05 21:22:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 1,000 ms |
| コード長 | 375 bytes |
| コンパイル時間 | 1,908 ms |
| コンパイル使用メモリ | 197,308 KB |
| 最終ジャッジ日時 | 2025-01-19 10:30:55 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int n;
vector<long long> a;
int main() {
cin >> n;
a.resize(n);
for (auto& p : a) cin >> p;
sort(a.begin(), a.end(), greater<long long>());
long long res = 0;
for (int id = 0, i = 0; id < n; ++i) {
for (int j = 0; j < (1 << i); ++j)
if (id < n) res += a[id++] * i;
}
cout << res << endl;
return 0;
}
m_tsubasa