Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C# by registered user Shadow ( 16 years ago )
using System;
using System.Collections.Generic;
using System.Text;
namespace Task
{
class Program
{
public class Mishen
{
public int left;
public int right;
public int top;
public int bottom;
public int depth;
}
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
List<Mishen> lst = new List<Mishen>(n);
for (int i = 0; i < n; i++)
{
string[] s1 = Console.ReadLine().Split(' ');
Mishen n1 = new Mishen();
lst.Add(n1);
lst[i].left = int.Parse(s1[0]);
lst[i].right = int.Parse(s1[1]);
lst[i].bottom = int.Parse(s1[2]);
lst[i].top = int.Parse(s1[3]);
lst[i].depth = int.Parse(s1[4]);
}
List<Mishen> lst1 = new List<Mishen>(n);
for (int i = 0; i < n; i++)
{
lst1.Add(lst[i]);
}
for (int i = 0; i < n; i++)
{
for (int j = i; j < n; j++)
{
if (lst[j].depth < lst[i].depth)
{
Mishen m = lst[i];
lst[i] = lst[j];
lst[j] = m;
}
}
}
int num = int.Parse(Console.ReadLine());
int[] cnt = new int[num];
for (int i = 0; i < num; i++)
{
string[] s1 = Console.ReadLine().Split(' ');
int x = int.Parse(s1[0]);
int y = int.Parse(s1[1]);
for (int j = 0; j < n; j++)
{
if (lst.Count > 0)
{
if ((x >= lst[j].left) && (x <= lst[j].right) && (y >= lst[j].bottom) && (y <= lst[j].top))
{
Mishen m = lst[j];
for (int k = 0; k < lst1.Count; k++)
{
if ((m.left == lst1[k].left)&&(m.right == lst1[k].right) && (m.bottom == lst1[k].bottom) && (m.top == lst1[k].top) && (m.depth == lst1[k].depth))
{
cnt[i] = k + 1;
break;
}
}
lst.Remove(lst[j]);
break;
}
}
}
}
for (int i = 0; i < num; i++)
{
Console.WriteLine(cnt[i].ToString());
}
}
}
}
Revise this Paste