結果

問題 No.1032 数数え
ユーザー kyo1
提出日時 2020-05-21 19:31:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 349 bytes
コンパイル時間 2,121 ms
コンパイル使用メモリ 194,568 KB
最終ジャッジ日時 2025-01-10 13:39:36
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<int> cnt(M + 1, 0);
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if (x <= M) cnt[x]++;
  }
  for (int i = 0; i < M; i++) {
    cout << i + 1 << ' ' << cnt[i + 1] << '\n';
  }
  return 0;
}
0