結果

問題 No.29 パワーアップ
ユーザー Crowea
提出日時 2019-02-04 13:21:30
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 777 bytes
コンパイル時間 1,077 ms
コンパイル使用メモリ 106,752 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2024-12-24 19:52:01
合計ジャッジ時間 2,834 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.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