結果

問題 No.647 明太子
ユーザー kenken
提出日時 2018-07-19 17:38:35
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 2,956 ms / 4,500 ms
コード長 1,723 bytes
コンパイル時間 1,914 ms
コンパイル使用メモリ 101,908 KB
実行使用メモリ 24,780 KB
最終ジャッジ日時 2023-08-25 18:04:39
合計ジャッジ時間 12,972 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,616 KB
testcase_01 AC 56 ms
20,712 KB
testcase_02 AC 55 ms
20,672 KB
testcase_03 AC 56 ms
20,756 KB
testcase_04 AC 56 ms
22,668 KB
testcase_05 AC 56 ms
22,620 KB
testcase_06 AC 56 ms
20,756 KB
testcase_07 AC 57 ms
22,756 KB
testcase_08 AC 55 ms
20,724 KB
testcase_09 AC 76 ms
20,656 KB
testcase_10 AC 101 ms
22,732 KB
testcase_11 AC 64 ms
18,760 KB
testcase_12 AC 91 ms
20,680 KB
testcase_13 AC 139 ms
20,712 KB
testcase_14 AC 1,094 ms
24,752 KB
testcase_15 AC 200 ms
22,700 KB
testcase_16 AC 93 ms
20,672 KB
testcase_17 AC 1,379 ms
20,644 KB
testcase_18 AC 1,491 ms
22,792 KB
testcase_19 AC 441 ms
20,712 KB
testcase_20 AC 471 ms
20,640 KB
testcase_21 AC 204 ms
20,680 KB
testcase_22 AC 2,956 ms
24,780 KB
testcase_23 AC 57 ms
20,764 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using static System.Console;

namespace Project2
{
    class Class1
    {
        public static void Main()
        {
            var n = int.Parse(ReadLine());
            var member = new int[n][];

            for(var i = 0; i < n; i++)
            {
                member[i] = new int[2];
                var inputArr = ReadLine().Split(' ');
                member[i][0] = int.Parse(inputArr[0]);
                member[i][1] = int.Parse(inputArr[1]);
            }

            var m = int.Parse(ReadLine());
            var mentaiko = new int[m];
            for (var i = 0; i < m; i++)
            {
                var inputArr = ReadLine().Split(' ');

                for(var j = 0; j < n; j++)
                {
                    if (member[j][0] >= int.Parse(inputArr[0]) && member[j][1] <= int.Parse(inputArr[1]))
                    {
                        mentaiko[i]++;
                    }
                }
            }

            var max = -1;
            var result = new int[m];
            var index = 0;
            for (var i = 0; i < m; i++)
            {
                if (mentaiko[i] == max)
                {
                    index++;
                    result[index] = i+1;
                }
                else if(mentaiko[i] > max)
                {
                    max = mentaiko[i];
                    index = 0;
                    result[0] = i+1;
                }
            }
            if (max == 0)
            {
                WriteLine(0);
            }
            else
            {
                for (var j = 0; j <= index; j++)
                {
                    WriteLine(result[j]);
                }
            }
            
        }
    }
}
0