結果

問題 No.29 パワーアップ
ユーザー fujitafujita
提出日時 2023-04-28 16:38:00
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 1,183 bytes
コンパイル時間 15,112 ms
コンパイル使用メモリ 146,252 KB
実行使用メモリ 164,308 KB
最終ジャッジ日時 2023-08-11 03:43:58
合計ジャッジ時間 15,922 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
28,940 KB
testcase_01 AC 54 ms
29,088 KB
testcase_02 AC 54 ms
30,840 KB
testcase_03 AC 55 ms
28,836 KB
testcase_04 AC 53 ms
31,028 KB
testcase_05 AC 55 ms
29,236 KB
testcase_06 AC 54 ms
28,896 KB
testcase_07 AC 54 ms
31,048 KB
testcase_08 AC 54 ms
29,004 KB
testcase_09 AC 53 ms
29,188 KB
testcase_10 AC 54 ms
28,808 KB
testcase_11 AC 54 ms
28,960 KB
testcase_12 AC 54 ms
29,088 KB
testcase_13 AC 55 ms
29,168 KB
testcase_14 AC 54 ms
28,932 KB
testcase_15 AC 56 ms
30,952 KB
testcase_16 AC 56 ms
28,836 KB
testcase_17 AC 54 ms
31,112 KB
testcase_18 AC 55 ms
31,088 KB
testcase_19 AC 56 ms
31,096 KB
testcase_20 AC 54 ms
28,828 KB
testcase_21 AC 55 ms
164,308 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 161 ms).
.NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f
Copyright (C) Microsoft Corporation.All rights reserved.

  プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください
  main -> /home/judge/data/code/bin/Release/net6.0/main.dll
  main -> /home/judge/data/code/bin/Release/net6.0/publish/

ソースコード

diff #

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

namespace yukicoder
{
    class Program
    {

        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            List<int> list = new List<int>();
            int count = 0;


            for (int i = 0; i < N; i++)
            {
                var O = Console.ReadLine().Split(" ");
                list.Add(int.Parse(O[0]));
                list.Add(int.Parse(O[1]));
                list.Add(int.Parse(O[2]));
            }

            list.Sort();

            for(int i = 0; i < list.Count - 1; i++)
            {
                for(int j = 1 + i; j < i + 2; j++)
                {
                    if (list[i] == list[j])
                    {
                        list.RemoveAt(i);
                        list.RemoveAt(j - 1);
                        i--;
                        j--;
                        count++;
                    }
                }
            }
            if(list.Count >= 4 )
            {
                count += list.Count / 4;
            }
            Console.WriteLine(count);
        }
    }
}
0