結果

問題 No.2777 Wild Flush
ユーザー xrつぼ
提出日時 2024-06-12 21:16:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 20,536 KB
最終ジャッジ日時 2024-06-12 21:16:08
合計ジャッジ時間 4,071 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))

a.sort()
zero_count = 0
max_count = 0
now = 0
now_count = 0
for x in a:
    if x == 0: zero_count += 1
    else:
        if now != x:
            now = x
            max_count = max(max_count, now_count)
            now_count = 1
        elif now == x:
            now_count += 1
max_count = max(max_count, now_count)

if zero_count + max_count >= k: print("Yes")
else: print("No")
0