結果

問題 No.1380 Borderline
ユーザー DaYuanChi
提出日時 2021-02-07 20:40:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 1,604 ms
コンパイル使用メモリ 171,552 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-04 13:43:46
合計ジャッジ時間 2,529 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 36 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    }
  }
  cout << ans << endl;
  return 0;
}
  
0