結果

問題 No.549 素材合成システム
ユーザー hogeover30
提出日時 2017-07-29 00:18:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 2,227 ms
コンパイル使用メモリ 195,528 KB
最終ジャッジ日時 2025-01-05 02:01:40
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n; cin>>n;
    multiset<int> a;
    for(int i=0; i<n; ++i) {
        int t; cin>>t;
        a.insert(t);
    }
    while (a.size()>1) {
        auto i=begin(a);
        auto j=end(a); --j;
        int x=*i/2+*j;
        a.erase(i);
        a.erase(j);
        a.insert(x);
    }
    cout<<*begin(a)<<endl;
}
0