結果

問題 No.1380 Borderline
ユーザー sten_san
提出日時 2021-02-07 20:32:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 800 bytes
コンパイル時間 1,722 ms
コンパイル使用メモリ 194,028 KB
最終ジャッジ日時 2025-01-18 13:52:02
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

struct uns_t {} uns;
template <typename Element, typename Head, typename ...Args>
auto vec(Element init, Head arg, Args ...args) {
    if constexpr (sizeof...(Args) == 0) return std::vector(arg, init);
    else return std::vector(arg, vec(init, args...));
}
template <typename Element, typename Head, typename ...Args>
auto vec(uns_t, Head arg, Args ...args) {
    return vec(Element(), arg, args...);
}

int main() {
    int n, k; cin >> n >> k;
    auto p = vec<int>(uns, n);
    for (auto &e : p) cin >> e;

    int ans = 0;
    for (int i = 0; i <= 400; ++i) {
        int cnt = 0;
        for (auto e : p) {
            cnt += i <= e;
        }

        if (cnt <= k) {
            ans = max(ans, cnt);
        }
    }

    cout << ans << endl;
}

0