結果
| 問題 |
No.1380 Borderline
|
| コンテスト | |
| ユーザー |
DaYuanChi
|
| 提出日時 | 2021-02-07 21:03:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 489 bytes |
| コンパイル時間 | 1,522 ms |
| コンパイル使用メモリ | 170,960 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 17:04:03 |
| 合計ジャッジ時間 | 2,635 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 41 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int cnt[405];
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());
reverse(p.begin(), p.end());
for(int i = 0; i < n; i++) cnt[p[i]]++;
int now = 0;
int ans = 0;
for(int i = 400; i>=0; i--){
now += cnt[i];
if(now>k){
ans = max(now-cnt[i],0);
break;
}
ans = now;
}
cout << ans << endl;
return 0;
}
DaYuanChi