-
-
Save dniku/c7b012d5f835ffd80728 to your computer and use it in GitHub Desktop.
Problem H from VK wild-card round #1. The language is Picat.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cp. | |
| main => | |
| N = read_int(), | |
| X = new_array(N), | |
| Y = new_array(N), | |
| foreach(I in 1..N) | |
| X[I] := read_int(), | |
| Y[I] := read_int() | |
| end, | |
| BestArea = 50000, | |
| foreach(A in 2..4) | |
| foreach(B in 2..4) | |
| Above := false, | |
| foreach(I in 1..N) | |
| Diff := Y[I] * A + B * X[I] - A * B, | |
| if Diff then | |
| Above := true | |
| end | |
| % Above := Above || (Y[I] * A + B * X[I] - A * B > 0) | |
| end, | |
| if (not Above) && (A * B < BestArea) then | |
| BestArea := A * B, | |
| printf("upd %d %d\n", A, B) | |
| end | |
| end | |
| end, | |
| writeln(BestArea / 2). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment