結果
問題 | No.1380 Borderline |
ユーザー |
![]() |
提出日時 | 2021-02-07 20:33:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 708 bytes |
コンパイル時間 | 2,073 ms |
コンパイル使用メモリ | 199,128 KB |
最終ジャッジ日時 | 2025-01-18 13:52:54 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 |
ソースコード
#include<bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int) n; i++) using ll = long long; using namespace std; const long long INF = 1ll << 60; template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { ll n, k; cin >> n >> k; vector<ll> v(n); rep(i, n) cin >> v[i]; sort(v.rbegin(), v.rend()); ll ans = 0; rep(j, 401) { ll cnt = 0; rep(i, n) cnt += (v[i] >= j); if (cnt <= k) chmax(ans, cnt); } cout << ans << endl; }