結果

問題 No.549 素材合成システム
ユーザー gigime
提出日時 2017-07-28 22:30:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 605 bytes
コンパイル時間 1,708 ms
コンパイル使用メモリ 168,828 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-10 05:06:50
合計ジャッジ時間 3,076 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int N;
vector<ll> A;

int main()
{
	scanf("%d",&N);
	A.assign(N,0);
	vector<ll> v(N,0);
	FOR(i,0,N){
		scanf("%lld",&A [i]);
		v [i] = A [i] / 2;
	}
	ll vSum = accumulate(v.begin(),v.end(),0ll);

	ll ans = 0;
	FOR(i,0,N){
		chmax(ans,A [i] + vSum - v [i]);
	}
	printf("%lld\n",ans);

	return 0;
}
0