結果
| 問題 | No.1416 ショッピングモール |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-05 21:26:06 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 1,000 ms |
| コード長 | 501 bytes |
| 記録 | |
| コンパイル時間 | 646 ms |
| コンパイル使用メモリ | 98,284 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-18 11:48:23 |
| 合計ジャッジ時間 | 1,870 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#line 1 "main.cpp"
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> xs(n);
for (auto& x : xs) cin >> x;
sort(xs.rbegin(), xs.rend());
int ans = 0, k = -1;
for (int i = 0; i < n; ++i) {
if (__builtin_popcount(i + 1) == 1) ++k;
ans += xs[i] * k;
}
cout << ans << "\n";
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
solve();
return 0;
}