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

Сборники > Data Structures > задача:


50549 - k-Nearest Neighbours (kNN)

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

Задачи сборника

• 50367 - Bar Codes
• 50386 - Conformity
• 50711 - Snail Trails
• 50472 - Minimum Sum Triangle
• 50842 - Minimum Sum Triangle - DP
• 50549 - k-Nearest Neighbours (...
• 50676 - Cinema Millennium
• 50678 - The Jumping Rabbit
• 50306 - Beautiful Numbers
• 50700 - Candidates for the Mayor
• 50692 - How much money?
• 50790 - Fire Alarm
• 50710 - Permutations
• 50709 - k-ary Strings

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
bfs.

k-Nearest Neighbours (kNN)

{By Florenc Skuka}

Nearest neighbour (NN) is a very well-known problem throughout data analysis and is often utilized in a variety of different algorithms. NN is an active area of research in computer vision, genetic sequencing and string matching, similarity search in unstructured databases, data clustering and analysis, and a variety of other artificial intelligence applications. Due to its versatility, advances in the speed and throughput of NN search often result in the acceleration of other related data intensive algorithms utilizing NN. Data algorithms such as mean-shift clustering, point-cloud modelling for image analysis, and content based image retrieval are often accelerated by a fast NN search that limits their model update and search space to only relevant, or adjacent data.

Question:
Write a program that reads the coordinates of points and find the total distance of k-Nearest Neighbours for a given point.

Input specification
In the first line you are given 5 numbers (n, k, x, y, z)

  • an integer number (n): number of points where 0 ≤ n ≤ 100,000.
  • an integer number (k)- the number of Nearest Neighbours where 0 ≤ k ≤ 50,000
  • three integers (x, y, z)- the coordinates of the point for which we are searching the kNN.
Then, in the following n lines, you are given coordinates (x, y, z) of n points where x, y, z coordinates are between -800 and 800.

Output specification
Show the total distance of k-Nearest Neighbours as floating point with 2 digits double precision

 Sample Input I     Sample Output I   
 9 4 3 2 4
 756 449 435
 -3 -7 6
 448 -102 452
 6 4 8
 -508 -478 -250
 16 -9 -11
 -561 492 -731
 1 3 7
 -690 -455 -268
 42.82


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

www.contester.ru