PrevNext

You're not signed in!

Sign in to save your progress and sync your settings across devices.

Very Frequent
 0/12

Basic Complete Search

Author: Darren Yao

An easy example: iterating through all pairs.

Resources
IUSACOmodule 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 NN (3N5000)(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 NN.

The second line contains NN integers, the xx-coordinates of the points: x1,x2,,xNx_1, x_2, \dots, x_N (1000xi1000-1000 \leq x_i \leq 1000).

The third line contains NN integers, the yy-coordinates of the points: y1,y2,,yNy_1, y_2, \dots, y_N (1000yi1000-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

This section is not complete.

Feel free to file a request to complete this using the "Contact Us" button.

compare difficulty / quality of these problems with those from sources mentioned in "Expected Knowledge"? (/general/expected) ex. VPlanet, CodeSignal?

StatusSourceProblem NameDifficultyTagsSolution
BronzeEasy
Show Tags

Nested Loop

External Sol
BronzeEasy
Show Tags

Nested Loop

External Sol
BronzeNormal
Show Tags

Nested Loop

External Sol
BronzeNormal
Show Tags

Nested Loop

External Sol
BronzeNormalExternal Sol
BronzeNormalExternal Sol
BronzeNormal
Show Tags

Nested Loop

BronzeHardExternal Sol
SilverHard
Show Tags

Nested Loop

External Sol
BronzeHardExternal Sol
BronzeVery HardExternal Sol
SilverVery Hard

Module Progress:

Give Us Feedback on Basic Complete Search!

PrevNext