結果
| 問題 |
No.647 明太子
|
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2018-09-08 15:20:14 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,511 bytes |
| コンパイル時間 | 1,918 ms |
| コンパイル使用メモリ | 110,392 KB |
| 実行使用メモリ | 25,520 KB |
| 最終ジャッジ日時 | 2024-12-16 06:35:00 |
| 合計ジャッジ時間 | 3,262 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 5 WA * 15 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Linq;
using System.Collections.Generic;
using System;
public class P
{
public int x { get; set; }
public int y { get; set; }
public int id { get; set; }
}
public class Hello
{
public static void Main()
{
var n = int.Parse(Console.ReadLine().Trim());
var a = new int[n, 2];
for (int i = 0; i < n; i++)
{
string[] line = Console.ReadLine().Trim().Split(' ');
a[i, 0] = int.Parse(line[0]);
a[i, 1] = int.Parse(line[1]);
}
var m = int.Parse(Console.ReadLine().Trim());
var ps = new P[m];
for (int i = 0; i < m; i++)
{
string[] line = Console.ReadLine().Trim().Split(' ');
var x = int.Parse(line[0]);
var y = int.Parse(line[1]);
ps[i] = new P { id = i, x = x, y = y };
}
var ps2 = ps.OrderBy(z => z.x).ToArray();
printAns(a, ps2);
}
public static void printAns(int[,] a, P[] b)
{
var ans = new List<int>();
var n = a.GetLength(0);
var m = b.Length;
var buy = new int[m];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
{
if (b[j].x > a[i, 0]) break;
if (b[j].y >= a[i, 1]) buy[j]++;
}
var max = buy.Max();
if (max == 0) { Console.WriteLine(0); return; }
for (int i = 0; i < m; i++)
if (buy[i] == max) Console.WriteLine(i + 1);
}
}
bluemegane