# Basic Complete Search

Author: Darren Yao

An easy example: iterating through all pairs.

Resources | |||
---|---|---|---|

IUSACO | module is based off this |

In many problems (especially in Bronze) it suffices to check all possible cases in the solution space, whether it be all elements, all pairs of elements, or all subsets, or all permutations. Unsurprisingly, this is called **complete search** (or **brute force**), because it completely searches the entire solution space.

## Example

You are given $N$ $(3 \leq N \leq 5000)$ integer points on the coordinate plane. Find the square of the maximum Euclidean distance (aka length of the straight line) between any two of the points.

### Input Format

The first line contains an integer $N$.

The second line contains $N$ integers, the $x$-coordinates of the points: $x_1, x_2, \dots, x_N$ ($-1000 \leq x_i \leq 1000$).

The third line contains $N$ integers, the $y$-coordinates of the points: $y_1, y_2, \dots, y_N$ ($-1000 \leq y_i \leq 1000$).

### Output Format

Print one integer, the square of the maximum Euclidean distance between any two of the points.

Solution

## Problems

Status | Source | Problem Name | Difficulty | Tags | Solution | URL |
---|---|---|---|---|---|---|

Bronze | Easy | ## Show TagsNested Loop | External Sol | |||

Bronze | Easy | ## Show TagsNested Loop | External Sol | |||

Bronze | Easy | ## Show TagsNested Loop | External Sol | |||

Bronze | Normal | ## Show TagsNested Loop | ||||

Bronze | Normal | ## Show TagsNested Loop | External Sol | |||

Bronze | Normal | External Sol | ||||

Bronze | Normal | External Sol | ||||

Bronze | Normal | ## Show TagsNested Loop | ||||

Bronze | Hard | External Sol | ||||

Silver | Hard | ## Show TagsNested Loop | External Sol | |||

Bronze | Hard | External Sol | ||||

Bronze | Very Hard | External Sol | ||||

Bronze | Very Hard | External Sol | ||||

Bronze | Very Hard | External Sol | ||||

Silver | Very Hard |

### Module Progress:

### Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!

## Give Us Feedback on Basic Complete Search!

Leave suggestions for us by making a post on the USACO Forum! Ex: Unclear sections, mislabeled problems, etc.