結果

問題 No.2777 Wild Flush
ユーザー Dương Nguyễn CảnhDương Nguyễn Cảnh
提出日時 2024-06-07 21:48:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 1,497 bytes
コンパイル時間 2,299 ms
コンパイル使用メモリ 206,828 KB
実行使用メモリ 8,064 KB
最終ジャッジ日時 2024-06-07 21:48:38
合計ジャッジ時間 3,763 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 7 ms
5,376 KB
testcase_10 AC 7 ms
5,376 KB
testcase_11 AC 6 ms
5,376 KB
testcase_12 AC 29 ms
8,064 KB
testcase_13 AC 35 ms
6,272 KB
testcase_14 AC 35 ms
6,400 KB
testcase_15 AC 35 ms
6,272 KB
testcase_16 AC 4 ms
5,376 KB
testcase_17 AC 32 ms
6,272 KB
testcase_18 AC 22 ms
5,376 KB
testcase_19 AC 21 ms
5,376 KB
testcase_20 AC 8 ms
5,376 KB
testcase_21 AC 6 ms
5,376 KB
testcase_22 AC 20 ms
5,376 KB
testcase_23 AC 19 ms
5,376 KB
testcase_24 AC 23 ms
5,632 KB
testcase_25 AC 35 ms
6,400 KB
testcase_26 AC 31 ms
6,016 KB
testcase_27 AC 15 ms
5,376 KB
testcase_28 AC 6 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt")
*/

#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define pb push_back
#define ff first
#define ss second
#define isz(x) (int)x.size()
using namespace std;

const int mxN = 2e5 + 5;
const int mod = 1e9 + 7;
const i64 oo = 1e18;

void solve() {
    int n, k;
    cin >> n >> k;

    map<int, int> mp;
    for (int i = 0; i < n; ++i) {
        int val; cin >> val;
        mp[val]++;
    }

    int res = 0, mx = 0;
    for (auto [val, cnt] : mp) {
        if (val == 0) res += cnt;
        else mx = max(mx, cnt);
    }
    cout << (res + mx < k ? "No" : "Yes") << endl;
}

signed main() {

#ifndef CDuongg
    if(fopen(taskname".inp", "r"))
        assert(freopen(taskname".inp", "r", stdin)), assert(freopen(taskname".out", "w", stdout));
#else
    freopen("bai3.inp", "r", stdin);
    freopen("bai3.out", "w", stdout);
    auto start = chrono::high_resolution_clock::now();
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1; //cin >> t;
    while(t--) solve();

#ifdef CDuongg
   auto end = chrono::high_resolution_clock::now();
   cout << "\n"; for(int i = 1; i <= 100; ++i) cout << '=';
   cout << "\nExecution time: " << chrono::duration_cast<chrono::milliseconds> (end - start).count() << "[ms]" << endl;
   cout << "Check array size pls sir" << endl;
#endif

}
0