結果

問題 No.2777 Wild Flush
ユーザー ArleenArleen
提出日時 2024-06-07 22:17:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 1,439 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 100,832 KB
最終ジャッジ日時 2024-06-07 22:18:01
合計ジャッジ時間 2,911 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
55,076 KB
testcase_01 AC 40 ms
54,584 KB
testcase_02 AC 38 ms
54,820 KB
testcase_03 AC 35 ms
55,472 KB
testcase_04 AC 36 ms
54,168 KB
testcase_05 AC 35 ms
54,808 KB
testcase_06 AC 35 ms
54,992 KB
testcase_07 AC 37 ms
53,976 KB
testcase_08 AC 36 ms
53,872 KB
testcase_09 AC 60 ms
82,184 KB
testcase_10 AC 59 ms
81,396 KB
testcase_11 AC 64 ms
81,792 KB
testcase_12 AC 83 ms
100,832 KB
testcase_13 AC 83 ms
96,164 KB
testcase_14 AC 86 ms
95,780 KB
testcase_15 AC 91 ms
95,916 KB
testcase_16 AC 52 ms
67,436 KB
testcase_17 AC 86 ms
96,236 KB
testcase_18 AC 74 ms
84,716 KB
testcase_19 AC 69 ms
84,488 KB
testcase_20 AC 56 ms
71,900 KB
testcase_21 AC 51 ms
67,604 KB
testcase_22 AC 68 ms
83,320 KB
testcase_23 AC 67 ms
82,156 KB
testcase_24 AC 70 ms
86,048 KB
testcase_25 AC 83 ms
96,424 KB
testcase_26 AC 80 ms
92,704 KB
testcase_27 AC 64 ms
78,128 KB
testcase_28 AC 47 ms
68,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# ゆーさんはN枚のカードを持っている
# すべてのカードにはちょうど1つのマークが書かれており、
# マークはマーク0, マーク1, ..., マークN の N+1種類である
# 持っているカードを順にカード1, カード2, ..., カードNとしたとき
# i枚目(where 1<=i<=N)のカードのマークはA_iである
# マーク0のカードは後述するカードを出す操作の直前に
# マーク1~Nのうちの任意のマークのカードに置き換えることができる
# 持っているカードからちょうどK枚のカードを選んで出す
# 出したカード全てが同じマークのカードになるようにカードを出せるかを判定せよ
#
# 1 <= K <= N <= 100000
# 0 <= A_i <= N (where 1<=i<=N)

import sys
import itertools
import time
from math import radians, sin, cos, tan, sqrt
from collections import deque

def input():
    return sys.stdin.readline().replace('\n','')
sys.setrecursionlimit(1000000)
md1 = 998244353
md2 = 10 ** 9 + 7

N, K = map(int, input().split())
A = list(map(int, input().split()))

dct = {}
for i in range(0, N):
    if A[i] not in dct:
        dct[A[i]] = 0
    dct[A[i]] += 1

flag = False
for i in range(1, N+1):
    card = 0
    if 0 in dct:
        card += dct[0]
    if i in dct:
        card += dct[i]
    
    if K <= card:
        flag = True
        break

if flag:
    print('Yes')
else:
    print('No')

0