結果
問題 | No.1416 ショッピングモール |
ユーザー |
|
提出日時 | 2021-03-10 23:42:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 1,000 ms |
コード長 | 276 bytes |
コンパイル時間 | 866 ms |
コンパイル使用メモリ | 68,724 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 13:32:04 |
合計ジャッジ時間 | 1,874 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream>#include<algorithm>using namespace std;int N;int A[50505];main(){cin>>N;for(int i=0;i<N;i++)cin>>A[i];sort(A,A+N);int cnt=1,f=0;int ans=0;for(int i=N;i--;){if(!cnt){cnt=1<<++f;}cnt--;ans+=A[i]*f;}cout<<ans<<endl;}