結果
| 問題 |
No.647 明太子
|
| コンテスト | |
| ユーザー |
バカらっく
|
| 提出日時 | 2018-02-09 22:34:44 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,171 bytes |
| コンパイル時間 | 1,007 ms |
| コンパイル使用メモリ | 115,912 KB |
| 実行使用メモリ | 29,856 KB |
| 最終ジャッジ日時 | 2024-12-26 07:39:03 |
| 合計ジャッジ時間 | 3,860 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 15 WA * 5 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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()));
Console.Write(ans.ToString());
}
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
3 4
1 7
5 3
4
1 5
2 6
5 2
6 7
";
}
public static void Main(string[] args)
{
#if DEBUG
Reader.IsDebug = true;
#endif
Program prg = new Program();
prg.Proc();
}
}
バカらっく