QOJ.ac

QOJ

时间限制: 1 s 内存限制: 2048 MB 总分: 100

#8377. What the Moo

统计

Given $n$ points in $d$-dimensional space. The Hamming distance between two points is defined as the number of dimensions in which their coordinates differ. For each point, find an approximately nearest other point such that the distance to the found point is no more than 20 times the distance to the actual nearest point.

Input

The first line contains two integers $n$ and $d$. Following this are $n$ lines, where the $i$-th line contains $d$ integers, representing the $d$-dimensional coordinates of the point with index $i$.

Output

Output $n$ lines, where the $i$-th line contains one integer, the index of the approximately nearest point to the point with index $i$.

Constraints

$2 \le n \le 10\,000$, $1 \le d \le 100$.

Subtasks

The score for each test case is distributed equally among the $n$ points. That is, if $m$ of the approximately nearest points you provide meet the requirement, you will receive $m/n$ of the total score for that test case.

Note

  • wtm_in.txt and wtm_ans.txt are provided as an example, where wtm_in.txt is the sample input and wtm_ans.txt is the answer file. The first line of the answer file contains $n$, and the subsequent lines indicate the Hamming distance between each point and its actual nearest point.
  • wtm_check.cpp is a checker program, which can be used as follows:
g++ wtm_chck.cpp -o wtm_chk
./wtm_chk wtm_in.txt wtm_ans.txt wtm_out.txt

Where wtm_in.txt and wtm_ans.txt are as described above, and wtm_out.txt is the standard output of your program after reading wtm_in.txt. The first line of the output from wtm_chk contains a number in $[0, 1]$, representing the proportion of the score your output achieves.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.