結果

問題 No.2799 Cut and Eat
ユーザー rin204
提出日時 2024-06-28 23:43:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2024-06-28 23:43:22
合計ジャッジ時間 2,628 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
all_ = sum(A)
ans = 0
t = 0
for a in A:
    if a > k:
        continue
    if t == 0:
        ans += a
    else:
        ans -= a
    t ^= 1

c = len([a for a in A if a >= k and a % 2 == 1])
if t == 0:
    ans += 1 - c & 1

print((all_ + ans) // 2)
0