結果

問題 No.647 明太子
ユーザー バカらっくバカらっく
提出日時 2018-02-09 22:37:49
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,258 bytes
コンパイル時間 2,085 ms
コンパイル使用メモリ 108,576 KB
実行使用メモリ 26,040 KB
最終ジャッジ日時 2023-08-27 02:15:41
合計ジャッジ時間 5,506 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
23,888 KB
testcase_01 AC 63 ms
21,796 KB
testcase_02 WA -
testcase_03 AC 65 ms
21,928 KB
testcase_04 AC 63 ms
19,908 KB
testcase_05 AC 65 ms
23,976 KB
testcase_06 AC 62 ms
23,836 KB
testcase_07 AC 64 ms
23,868 KB
testcase_08 AC 61 ms
21,832 KB
testcase_09 AC 67 ms
21,876 KB
testcase_10 AC 69 ms
21,896 KB
testcase_11 AC 68 ms
23,904 KB
testcase_12 AC 69 ms
21,908 KB
testcase_13 AC 74 ms
23,964 KB
testcase_14 AC 201 ms
23,928 KB
testcase_15 AC 82 ms
23,912 KB
testcase_16 AC 71 ms
23,896 KB
testcase_17 AC 238 ms
25,908 KB
testcase_18 AC 251 ms
23,912 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 284 ms
26,040 KB
testcase_23 AC 63 ms
23,940 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.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int memberCount = int.Parse(Reader.ReadLine());
        this.mentaiMembers = new Person[memberCount];
        for (int i = 0; i < memberCount; i++) {
            this.mentaiMembers[i] = new Person(Reader.ReadLine());
        }
        Dictionary<int, int> mentai = new Dictionary<int, int>();
        int mentaiCount = int.Parse(Reader.ReadLine());
        int maxBuy = 0;
        for (int i = 0; i < mentaiCount; i++) {
            int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            int price = inpt[0];
            int karasa = inpt[1];
            int buy = this.mentaiMembers.Count(a => a.Kane >= price && a.Karasa <= karasa);
            mentai.Add(i+1, buy);
            maxBuy = Math.Max(maxBuy, buy);
        }

        StringBuilder ans = new StringBuilder();
        mentai.Where(a=>a.Value==maxBuy).OrderBy(a=>a.Key).ToList().ForEach(a=>ans.AppendLine(a.Key.ToString()));
        if(ans.Length>0) {
            Console.Write(ans.ToString());
        } else {
            Console.WriteLine(0);
        }
    }

    Person[] mentaiMembers;

    private class Person {
        public int Kane;
        public int Karasa;
        public Person(string inpt) {
            int[] tmp = inpt.Split(' ').Select(a => int.Parse(a)).ToArray();
            this.Kane = tmp[0];
            this.Karasa = tmp[1];
        }
    }


    public class Reader
    {
        private static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"


3
6 4
5 2
2 5
2
4 3
5 4

";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}
0