結果

問題 No.29 パワーアップ
ユーザー curryudon08curryudon08
提出日時 2020-06-22 16:35:30
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 66 ms / 5,000 ms
コード長 923 bytes
コンパイル時間 2,322 ms
コンパイル使用メモリ 104,544 KB
実行使用メモリ 23,796 KB
最終ジャッジ日時 2023-09-16 19:14:59
合計ジャッジ時間 4,866 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,628 KB
testcase_01 AC 63 ms
19,520 KB
testcase_02 AC 65 ms
21,712 KB
testcase_03 AC 64 ms
21,724 KB
testcase_04 AC 66 ms
23,692 KB
testcase_05 AC 65 ms
21,624 KB
testcase_06 AC 64 ms
21,676 KB
testcase_07 AC 65 ms
21,848 KB
testcase_08 AC 65 ms
21,564 KB
testcase_09 AC 65 ms
23,720 KB
testcase_10 AC 65 ms
21,648 KB
testcase_11 AC 64 ms
21,716 KB
testcase_12 AC 64 ms
19,604 KB
testcase_13 AC 64 ms
19,516 KB
testcase_14 AC 65 ms
21,772 KB
testcase_15 AC 65 ms
21,680 KB
testcase_16 AC 64 ms
21,640 KB
testcase_17 AC 64 ms
21,796 KB
testcase_18 AC 64 ms
21,668 KB
testcase_19 AC 64 ms
23,632 KB
testcase_20 AC 64 ms
23,648 KB
testcase_21 AC 64 ms
23,796 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 _0029
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var d = new Dictionary<int,int>();

            var p = 0;
            for(var i = 0; i < n; i++){
                var t = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
                for(var j = 0; j < 3; j++){
                    var m = t[j];
                    if(d.ContainsKey(m)){
                        d[m] += 1;
                        if(d[m] == 2){
                            p += 1;
                            d[m] = 0;
                        }
                    }else{
                        d.Add(m,1);
                    }
                }
            }

            var s = d.Sum(x => x.Value);
            Console.WriteLine(s / 4 + p);
        }
    }
}
0