結果
| 問題 |
No.29 パワーアップ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-02-04 13:21:30 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 777 bytes |
| コンパイル時間 | 866 ms |
| コンパイル使用メモリ | 115,084 KB |
| 実行使用メモリ | 28,288 KB |
| 最終ジャッジ日時 | 2025-10-24 21:08:54 |
| 合計ジャッジ時間 | 2,336 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / 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.
ソースコード
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);
}
}