結果

問題 No.1692 Expectations
ユーザー mmn15277198mmn15277198
提出日時 2021-10-03 01:32:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 894 ms
コンパイル使用メモリ 101,032 KB
実行使用メモリ 13,092 KB
最終ジャッジ日時 2023-09-28 02:03:23
合計ジャッジ時間 2,572 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 47 ms
4,380 KB
testcase_11 AC 47 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 10 ms
4,376 KB
testcase_15 AC 94 ms
8,940 KB
testcase_16 AC 11 ms
4,376 KB
testcase_17 AC 47 ms
6,700 KB
testcase_18 AC 19 ms
4,880 KB
testcase_19 AC 113 ms
9,668 KB
testcase_20 AC 86 ms
11,872 KB
testcase_21 AC 100 ms
13,092 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:28:24: 警告: ‘mn’ may be used uninitialized [-Wmaybe-uninitialized]
   28 |   cout << mx << " " << mn << endl;
      |                        ^~
main.cpp:23:7: 備考: ‘mn’ はここで定義されています
   23 |   int mn;
      |       ^~

ソースコード

diff #

#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;
}
0