ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > IMPC - 2013-2014 > задача:


2013-12-10. 50352 - Selling Cows

IMPC - 2013-2014

Старт: 16.мар.2013 в 12:00:00
Финиш: 16.мар.2013 в 17:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (1)

Задачи турнира

• 2013-04-50. 50774 - Hot Potato
• 2013-04-70. 50296 - Total Discount...
• 2013-04-80. 50343 - The number of...
• 2013-04-90. 50332 - Variance of a ...
• 2013-05-10. 50552 - Kepuce te perd...
• 2013-05-30. 50580 - Sa dite kane ka...
• 2013-05-40. 50553 - I pjestueshem...
• 2013-05-50. 50593 - Transportimi
• 2013-12-10. 50352 - Selling Cows
• 2013-12-40. 50342 - 100 Factorial
• 2013-12-50. 50674 - Collecting Eggs
• 2013-Nov-01. 50328 - How far away
• 2013-Nov-02. 50347 - Selling Oranges
• 2013-Nov-05. 50354 - Intersecting ...

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan (imesecan@gmail.com).

Selling Cows

Farmer John has many cows. Time to time he goes to sell some of them. He doesn't sell a cow if it's smaller than or equal to certain weight (w). And, he tries to sell the smallest one that is heavier than w.

Question:
Write a program that finds the cow that is the smallest of the ones which are heavier than w kgs.

Input specification
You will be given two integer numbers (n and w) at the beginning where 1 ≤ n ≤ 5000 and 1 ≤ k ≤ 1000. Then, in the following n lines, you will be given n integers: the weights of n cows.

Output specification
Show just one integer number: the position of the first cow which complies the given condition. If there is no cow that is heavier than w then show -1.
Note: Positions start from 1.

 Sample Input I   
  7 10
  7 15 10 8 17 11 20
 Sample Input II   
  6 50
  12 30 28 7 41 50
 Sample Output I   
  6
 Sample Output II   
  -1


Для отправки решений необходимо выполнить вход.

www.contester.ru