結果

問題 No.1032 数数え
ユーザー yorry2101yorry2101
提出日時 2023-09-22 23:48:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 449 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 2,483 ms
コンパイル使用メモリ 83,808 KB
実行使用メモリ 12,720 KB
最終ジャッジ日時 2023-09-22 23:48:13
合計ジャッジ時間 3,102 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 449 ms
12,720 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 19 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 406 ms
12,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;
int main(void){
    int n, m;
    cin >> n >> m;
    map<int, int> mp;
    int l;
    for (int i = 0; i < n; i++) {
        cin >> l;
        if (l <= m) {
            if (mp.find(l) == mp.end()) {
                mp.insert(make_pair(l, 1));
            }
            else mp[l]++;
        }
    }
    
    for (int i = 1; i <= m; i++) {
        cout << i << " " << mp[i] << endl;
    }
}
0