結果
問題 | No.1416 ショッピングモール |
ユーザー |
![]() |
提出日時 | 2021-03-05 21:32:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 1,000 ms |
コード長 | 539 bytes |
コンパイル時間 | 852 ms |
コンパイル使用メモリ | 84,756 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-07 00:40:22 |
合計ジャッジ時間 | 1,736 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <iostream>#include <string>#include <algorithm>#include <utility>#include <cmath>#include <cstdlib>#include <map>#include <set>#include <queue>#include <vector>using namespace std;int main() {long long n; cin >> n;long long A[50000];for (int i = 0; i < n; i++) cin >> A[i];long long ans = 0;sort(A, A + n, greater<long long>());for (long long i = 0; i < n; i++) {long long B = i + 1;long long count = 0;while (B != 1) {B /= 2;count++;}ans += count * A[i];}cout << ans << endl;}