結果

問題 No.549 素材合成システム
ユーザー tamtam484tamtam484
提出日時 2017-07-28 23:08:16
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 1,402 bytes
コンパイル時間 768 ms
コンパイル使用メモリ 105,360 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-10 04:44:07
合計ジャッジ時間 2,334 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <sstream> //string stream its useful!
#include<string>
#include<iostream>
#include<utility> //pair
#include <vector> // vector
#include <algorithm>    // swap,sort,binary_search
#include <functional>   // std::greater
#include <map> //map
#include<set> //set
#include<queue> //queue
#include<list> //list
#include<cmath>
#include<numeric>
#include<cassert>
#include <iomanip> //cout<<setprecision
#include <regex>
#include <ctype.h> //toupper case
#include <tuple>

typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
ll W = 1000000007;


using namespace std;
void omajinai() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(15);
}

class Main{
public:
    int N;
    vector<int> x;
    Main(){
        cin>>N;
        x = vector<int>(N);
        REP(i,N) cin>>x[i];
    }
    
    long saiyo(){
        vector<int> y(N);
        REP(i,N) y[i] = x[i] - x[i]/2;
        return x[distance(y.begin(),max_element(y.begin(),y.end()))];
    }
    
    void run(){
        
        const long s = saiyo();
        const long ans = accumulate(x.begin(),x.end(),0L,[](long l,int x){
            return l + x/2;
        }) - s/2 + s;
        cout<<ans<<endl;
    }
};

#ifndef gtest
int main(){
    omajinai();
    Main().run();
    return 0;
}
#endif
0