HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > "Informatics Stars" Online Contests - 2011-2014 > problem:


2013-01-30. 50599 - Sum of Squared Error (SSE) Distance

"Informatics Stars" Online Contests - 2011-2014

Start: Oct.20.2012 at 10:00:00 AM
Finish: Oct.20.2012 at 03:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 2012-10-02. 50555 - Frequency of L...
• 2012-10-04. 50598 - Minimum Sum
• 2012-11-30. 50656 - Divisibility by 11
• 2012-11-40. 50558 - Biggest Barn
• 2012-12-10. 50546 - Average Fuel P...
• 2012-12-20. 50574 - Triangular Nu...
• 2012-12-30. 50684 - Sum of prime ...
• 2013-01-10. 50584 - Total invoice ...
• 2013-01-30. 50599 - Sum of Sq...
• 2013-03-20. 50578 - Mersenne prime
• 2013-03-30. 50360 - National Elections
• 2013-03-40. 50705 - Student Clubs
• 2014-04-10. 50547 - Close Pair
• 2014-04-30. 50560 - Max Distance
• 2014-04-50. 50569 - 12th Grade Ele...
• 2014-04-50. 50703 - The Shortest Path

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 4000/7000/7000/7000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

Sum of Squared Error (SSE) Distance

Shqip

Sum of squared error is used to find the closest match of one vector or array. You subtract every element of a vector (one dimensional array) from every element of another vector. Then you calculate the sum of squares to calculate the SSE distance using the following formula:


You will be given a one dimensional array containing n floating point numbers. There are m other n-element testing vectors which are to be compared with the original data. And, you are to find out the one which is closest (or same) to the original data.

Input specification
The first line contains two numbers n and m where 1 ≤ n ≤ 500 and 2 ≤ m ≤ 1000. The next line will contain the original vector and the following m lines contain the testing vectors. The elements of the arrays are random numbers between -500 and +500.

Output specification
Show just one number j where 1 ≤ j ≤ m where jth array is the closest match to (or the same as) the original array.

Sample Input:
5 3
3.0 3.0 3.0 3.0 3.1
2.0 4.0 4.0 4.0 4.0
3.0 3.0 3.0 2.0 3.0
5.0 2.0 7.0 5.0 2.0

Sample Output:
2

Sample Output Explanation:
(3-2)² + (3-4)² + (3-4)² + (3-4)² + (3.1-4)² = 4.81
(3-3)² + (3-3)² + (3-3)² + (3-2)² + (3.1-3)² = 1.01
(3-5)² + (3-2)² + (3-7)² + (3-5)² + (3.1-2)² = 26.21
According to this calculations, the second vector has the smallest SSE distance.

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

www.contester.ru