{"problem":{"name":"008. N-Dimensional Distance","description":{"content":"Calculate the distance between two points of a specified dimension. The common distance formula still applies to higher dimensional points with a small modification. You will input two points and disp","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10269008"},"statements":[{"statement_type":"Markdown","content":"Calculate the distance between two points of a specified dimension. The common distance formula still applies to higher dimensional points with a small modification. You will input two points and display the distance between them as you normally would with the distance formula.\n\nThe n-dimensional distance formula can be expressed as\n\n$d (p, q) = sqrt((q_1 -p_1)^2 + (q_2 -p_2)^2 +... + (q_n -p_n)^2)$\n\nor in other terms:\n\n$sqrt(sum_(i = 1)^n (q_i -p_i)^2) = d$\n\nRemember that _math.sqrt_ will calculate the square root of a number (you also have to add the line _import math_ at the top of the program).\n\nThe first line contains the dimension D between 2 and 500. Then, D test cases will follow.\n\nEach test case N will consist of two lines: the value of the first point, and the value of the second point, in the Nth dimension.\n\nEach of these values is an integer between -5000 and 5000, inclusive.\n\nA decimal number N representing the distance between the two points. Do not round your answer.\n\n## Input\n\nThe first line contains the dimension D between 2 and 500. Then, D test cases will follow.Each test case N will consist of two lines: the value of the first point, and the value of the second point, in the Nth dimension.Each of these values is an integer between -5000 and 5000, inclusive.\n\n## Output\n\nA decimal number N representing the distance between the two points. Do not round your answer.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ D \\in \\mathbb{Z} $ be the dimension, with $ 2 \\leq D \\leq 500 $.  \nLet $ \\mathbf{p} = (p_1, p_2, \\dots, p_D) $ and $ \\mathbf{q} = (q_1, q_2, \\dots, q_D) $ be two points in $ \\mathbb{R}^D $, where $ p_i, q_i \\in \\mathbb{Z} $ and $ -5000 \\leq p_i, q_i \\leq 5000 $ for all $ i \\in \\{1, \\dots, D\\} $.\n\n**Constraints**  \n1. $ 2 \\leq D \\leq 500 $  \n2. $ p_i, q_i \\in \\mathbb{Z} $ and $ -5000 \\leq p_i, q_i \\leq 5000 $ for all $ i \\in \\{1, \\dots, D\\} $\n\n**Objective**  \nCompute the Euclidean distance $ d(\\mathbf{p}, \\mathbf{q}) $:  \n$$\nd(\\mathbf{p}, \\mathbf{q}) = \\sqrt{\\sum_{i=1}^{D} (q_i - p_i)^2}\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10269008","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}