結果

問題 No.1032 数数え
ユーザー ui_mtc
提出日時 2020-05-04 01:03:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 493 ms / 2,000 ms
コード長 485 bytes
コンパイル時間 1,691 ms
コンパイル使用メモリ 173,328 KB
実行使用メモリ 16,000 KB
最終ジャッジ日時 2024-06-23 06:56:35
合計ジャッジ時間 3,675 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;

signed main() {
  int N, M;
  cin >> N >> M;
  
  map<int, int> num;
  for( int i = 0; i < N; i++ ){
    int L;
    cin >> L;
    if( L > M ) continue;
    if( num.count(L) ) num[L]++;
    else num[L] = 1;
  }
  
  for( int i = 1; i <= M; i++ ){
    if( num.count(i) ) cout << i << " " << num[i] << endl;
    else cout << i << " " << 0 << endl;
  }
  
}
0