結果

問題 No.1032 数数え
ユーザー curryudon08curryudon08
提出日時 2020-07-03 16:54:39
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 587 ms / 2,000 ms
コード長 939 bytes
コンパイル時間 3,723 ms
コンパイル使用メモリ 104,800 KB
実行使用メモリ 52,212 KB
最終ジャッジ日時 2023-10-14 23:46:00
合計ジャッジ時間 6,923 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,932 KB
testcase_01 AC 63 ms
21,916 KB
testcase_02 AC 64 ms
23,932 KB
testcase_03 AC 60 ms
21,848 KB
testcase_04 AC 58 ms
21,964 KB
testcase_05 AC 60 ms
23,924 KB
testcase_06 AC 59 ms
21,988 KB
testcase_07 AC 587 ms
52,212 KB
testcase_08 AC 64 ms
23,992 KB
testcase_09 AC 90 ms
22,076 KB
testcase_10 AC 68 ms
22,168 KB
testcase_11 AC 60 ms
21,980 KB
testcase_12 AC 559 ms
40,196 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
using System.Collections.Generic;

namespace _1032
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var n = long.Parse(_[0]);
            var m = long.Parse(_[1]);
            var s = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();

            var d = new Dictionary<long,long>();
            for(var i = 0; i < n; i++){
                var t = s[i];
                if(d.ContainsKey(t)){
                    d[t] += 1;
                }else{
                    d.Add(t,1);
                }
            }

            for(var i = 1; i <= m; i++){
                if(d.ContainsKey(i)){
                    Console.WriteLine(string.Format("{0} {1}",i,d[i]));
                }else{
                    Console.WriteLine(string.Format("{0} {1}",i,0));
                }
            }
        }
    }
}
0