結果
問題 |
No.1046 Fruits Rush
|
ユーザー |
![]() |
提出日時 | 2024-04-30 14:33:52 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 234 bytes |
コンパイル時間 | 99 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-20 10:01:42 |
合計ジャッジ時間 | 1,332 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 8 WA * 6 |
ソースコード
n,k = map(int,input().split()) ls = list(map(int,input().split())) s = 0 t = 0 u = -100 for i in range(len(ls)): if ls[i] < 0: u = max(u,ls[i]) else: t += 1 ls.sort(reverse=True) if t != 0: print(sum(ls[:k])) else: print(u)