Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
|---|---|---|---|---|---|---|
| 2038 | 2024-2025 ICPC, NERC, Southern and Volga Russian Regional Contest (Unrated, Online Mirror, ICPC Rules, Preferably Teams) | FINISHED | False | 18000 | 44479523 | Nov. 18, 2024, 10:35 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 6884 ) | C | DIY | PROGRAMMING | geometry greedy | 1400 |
You are given a list of (n) integers (a_1, a_2, \dots, a_n). You need to pick (8) elements from the list and use them as coordinates of four points. These four points should be corners of a rectangle which has its sides parallel to the coordinate axes. Your task is to pick coordinates in such a way that the resulting rectangle has the maximum possible area. The rectangle can be degenerate, i. e. its area can be (0). Each integer can be used as many times as it occurs in the list (or less). The first line contains one integer (t) ((1 \le t \le 25\,000)) — the number of test cases. The first line of each test case contains one integer (n) ((8 \le n \le 2 \cdot 10^5)). The second line of each test case contains (n) integers (a_1, a_2, \dots, a_n) ((-10^9 \le a_i \le 10^9)). Additional constraint on the input: the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, print the answer as follows: if it is impossible to construct a rectangle which meets the constraints from the statement, print a single line containing the word NO (case-insensitive); otherwise, in the first line, print YES (case-insensitive). In the second line, print (8) integers (x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4) — the coordinates of the corners of the rectangle. You can print the corners in any order. |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 292234254 | TheGrayed | C | Nov. 18, 2024, 6:03 p.m. | OK | C# 10 | TESTS | 46 | 171 | 25804800 | 1400 |
Back to search problems