結果
問題 | No.1416 ショッピングモール |
ユーザー |
![]() |
提出日時 | 2021-03-05 21:53:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 1,000 ms |
コード長 | 418 bytes |
コンパイル時間 | 1,880 ms |
コンパイル使用メモリ | 195,168 KB |
最終ジャッジ日時 | 2025-01-19 10:55:24 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:11:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d", &a); | ~~~~~^~~~~~~~~~
ソースコード
#include<bits/stdc++.h>#define REP(i,b,e) for(int i=b;i<e;i++)using ll = int_fast64_t;int main(){int n;scanf("%d", &n);std::priority_queue<int> que;REP(i, 0, n){int a;scanf("%d", &a);que.push(a);}ll ans = 0;REP(i, 0, 20){REP(j, 0, 1<<i){ll tmp = que.top();que.pop();ans += tmp * i;if(que.empty()) break;}if(que.empty()) break;}printf("%ld\n", ans);return 0;}