結果
問題 | No.1380 Borderline |
ユーザー |
|
提出日時 | 2021-02-07 20:35:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 1,627 ms |
コンパイル使用メモリ | 169,104 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 17:00:49 |
合計ジャッジ時間 | 2,678 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 |
ソースコード
#include<bits/stdc++.h>#define endl '\n'using namespace std;int a[200];int n,k;int main(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cin>>n>>k;int last = 0;for(int i=0; i<n; i++){cin>>a[i];}sort(a,a+n);reverse(a,a+n);if(a[k-1] == a[k] && k < n){int i=k-1;while(a[i] == a[k] && i >= 0){i--;}cout<<i+1<<endl;return 0;}cout<<min(k,n)<<endl;}