結果

問題 No.2334 Distinct Cards
ユーザー yicode
提出日時 2023-06-11 17:37:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 431 bytes
コンパイル時間 1,629 ms
コンパイル使用メモリ 166,620 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2025-01-03 04:00:12
合計ジャッジ時間 3,496 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7 WA * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:20: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   13 |   for (const auto& [key, value] : dic) {
      |                    ^
main.cpp:17:20: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   17 |   for (const auto& [key, value] : ans) {
      |                    ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
int main() {
  int N,K; cin >> N >> K;
  map<int,int> dic;
  for(int i = 0; i < N; i++) {
    int a; cin >> a;
    dic[a]++;
  }
  map<int,int> ans;
  for (const auto& [key, value] : dic) {
    ans[value]++;
  }
  int x = -1;
  for (const auto& [key, value] : ans) {
    x = max(value,x);
    
  }
  cout << min(x,K) << endl;
}
0