結果

問題 No.29 パワーアップ
ユーザー CroweaCrowea
提出日時 2019-02-04 13:21:30
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 777 bytes
コンパイル時間 1,164 ms
コンパイル使用メモリ 68,164 KB
実行使用メモリ 25,852 KB
最終ジャッジ日時 2023-08-26 05:15:58
合計ジャッジ時間 4,035 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
23,636 KB
testcase_01 AC 65 ms
23,720 KB
testcase_02 AC 65 ms
21,648 KB
testcase_03 AC 65 ms
23,588 KB
testcase_04 AC 65 ms
21,636 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 65 ms
21,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Program
{
    public static void Main(string[] args)
    {
        var map = new Dictionary<int, int>();
        var n = int.Parse(Console.ReadLine());

        int[] items;
        for (var i=0; i<n; i++)
        {
            items = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            foreach (var data in items)
            {
                if (map.ContainsKey(data)) map[data]++;
                else map.Add(data, 1);
            }
        }
        var moreTwos = map.Values.Where(x => x >= 2).ToList();
        var ones = map.Values.Where(x => x == 1).ToList();
        int count = moreTwos.Sum() / 2 + ones.Sum() / 4;
        Console.WriteLine(count);
    }
}
0