+ 3
***[Super Challenge]*** ver.3.0
Here is a task for you. Imagine that you drop some points on 2D-plane with system of 2 axes (x and y). You must drop at last 4 points on each coordinate quarter (there are 4 quarters). Now if you connect these points by order of their quarters (each dot in its own quarter) you will get a quadrangle. Task: find MAX square and print it with 4 dots coordinates. A (1; 1), B(1; -1), C(-1; -1), D(-1;1) and E(2; 2) we will get 2 quadrangles. MAX Square is 6.5 Input ends when next dot will have coordinates (0; 0)
6 Antworten
+ 1
#One more example of input:
1 1
1 -1
-1 -1
2 2
-1 1
1 -2
0 0
#Output is:
Maximum square is 6.5
Its Dots are: (2; 2), (1; -2), (-1; -1), (-1; 1)
+ 1
My attempt right here:
https://code.sololearn.com/c1tkKcfTD93s/?ref=app
+ 1
@hinanawi
Maybe you can explain what n^4 time means?
I made 1 square of quadrangle from 2 triangles :-)
+ 1
dimon2101 n⁴ time is because of the 4 nested loops. keep in mind that doesn't mean the code is bad, just that the problem is hard to optimize
+ 1
@hinanawi
I'm Agree with you. Optimization is the next step ;-)
0
yikes n⁴ time solution on optimal