結果

問題 No.1380 Borderline
ユーザー sister_DB
提出日時 2021-02-28 19:36:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 622 ms
コンパイル使用メモリ 78,440 KB
最終ジャッジ日時 2025-01-19 08:15:28
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    
    vector<int> p(n);
    
    for(int i = 0; i < n; ++i){
        cin >> p[i];
    }
    
    sort(p.begin(), p.end());
    
    int ans = 0;
    for(int i = 400; i >= 0; --i){
        int num = p.end() - lower_bound(p.begin(), p.end(), i);
        if(num <= k){
            ans = num;
        }else{
            break;
        }
    }
    cout << ans << endl;
    
    return 0;
}
0