結果
| 問題 | 
                            No.2777 Wild Flush
                             | 
                    
| コンテスト | |
| ユーザー | 
                             NAMIDAIRO
                         | 
                    
| 提出日時 | 2024-06-07 21:49:14 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 33 ms / 2,000 ms | 
| コード長 | 934 bytes | 
| コンパイル時間 | 996 ms | 
| コンパイル使用メモリ | 112,960 KB | 
| 最終ジャッジ日時 | 2025-02-21 20:11:10 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 24 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <random>
#include <iomanip>
#include <string>
#include <cmath>
#include <complex>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
template<class T>
using vi = vector<T>;
template<class T>
using vii = vector<vi<T>>;
template<class T>
using viii = vector<vii<T>>;
template<class T>
using viiii = vector<viii<T>>;
using P = pair<ll, int>;
void chmin(ll & x, ll y) { x = min(x, y); }
void chmax(ll& x, ll y) { x = max(x, y); }
int main()
{
    int n, k;
    cin >> n >> k;
    vi<int> cnt(n + 1);
    rep(i, n) {
        int a;
        cin >> a;
        cnt[a]++;
    }
    for (int i = 1; i <= n; i++) {
        if (cnt[i] <= k && cnt[i] + cnt[0] >= k) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}
            
            
            
        
            
NAMIDAIRO