結果
問題 |
No.1380 Borderline
|
ユーザー |
|
提出日時 | 2021-02-13 21:32:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 555 bytes |
コンパイル時間 | 592 ms |
コンパイル使用メモリ | 71,416 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-21 01:34:14 |
合計ジャッジ時間 | 2,184 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main(){ int n,k; cin >> n >> k; int bm = 0; vector<int> p(n); for(int i=0; i<n; i++){ cin >> p.at(i); bm = max(bm,p.at(i)); } int b = 0; int cnt = 0; int ans = 0; while(b <= bm){ for(int i=0; i<n; i++){ if(p.at(i) >= b){ cnt++; } } if(cnt <= k){ ans = max(ans,cnt); } b++; cnt = 0; } cout << ans << endl; }