結果
問題 | No.1380 Borderline |
ユーザー |
|
提出日時 | 2021-02-07 20:31:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 305 bytes |
コンパイル時間 | 589 ms |
コンパイル使用メモリ | 70,024 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 16:54:25 |
合計ジャッジ時間 | 1,989 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream>#include<algorithm>using namespace std;int N,K;int P[200];main(){cin>>N>>K;for(int i=0;i<N;i++)cin>>P[i];sort(P,P+N);int ans=0;for(int i=N-1;i>=0;){int j=i;while(j>=0&&P[i]==P[j])j--;int k=i-j;i=j;if(ans+k<=K)ans+=k;else break;}cout<<ans<<endl;}