結果

問題 No.2799 Cut and Eat
コンテスト
ユーザー shobonvip
提出日時 2024-06-27 00:33:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2024-06-27 00:33:45
合計ジャッジ時間 2,427 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int,input().split())
def v(x):
	if x <= k:
		return x
	return - (x%2)

a = list(map(int,input().split()))
b = [v(x) for x in a]
b.sort(lambda x: -x)

ans = 0
mode = 0
for i in b:
	if mode:
		ans -= i
	else:
		ans += i
	mode ^= 1
print((sum(a) + ans) // 2)
0