結果
問題 |
No.1692 Expectations
|
ユーザー |
![]() |
提出日時 | 2021-10-03 01:32:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 143 ms / 2,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 993 ms |
コンパイル使用メモリ | 100,860 KB |
実行使用メモリ | 13,440 KB |
最終ジャッジ日時 | 2024-07-20 20:40:03 |
合計ジャッジ時間 | 2,659 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:28:24: warning: 'mn' may be used uninitialized [-Wmaybe-uninitialized] 28 | cout << mx << " " << mn << endl; | ^~ main.cpp:23:7: note: 'mn' was declared here 23 | int mn; | ^~
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <functional> #include <queue> #include <map> #include <cmath> #include <iomanip> using namespace std; int main() { int n , m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = 0; map<int,int> mp; for (int i = 0; i < n; i++) { mp[a[i]]++; } int mx = min((int)mp.size() , m); int mn; if (mp.size() == 1) { if (n >= m) mn = 1; else mn = 0; } cout << mx << " " << mn << endl; return 0; }