結果
| 問題 |
No.1416 ショッピングモール
|
| コンテスト | |
| ユーザー |
harurun
|
| 提出日時 | 2020-12-17 12:24:15 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 1,000 ms |
| コード長 | 397 bytes |
| コンパイル時間 | 1,499 ms |
| コンパイル使用メモリ | 65,808 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-20 06:57:53 |
| 合計ジャッジ時間 | 2,375 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int n,ans=0,cnt=0,N,a=1;
cin>>n;
N=n;
vector<int> A(n);
for(int i=0;i<n;i++)cin>>A.at(i);
sort(A.rbegin(),A.rend());
for(int i=0;i<17;i++){
a=min(a,N);
for(int j=0;j<a;j++){
ans+=i*A.at(cnt++);
}
N-=a;
a*=2;
if(N<=0)break;
}
cout<<ans<<endl;
return 0;
}
harurun