File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
- from typing import List
3
2
from math import sin , cos , sqrt
3
+ from __static__ import CheckedList , inline
4
+ from typing import final
4
5
import time
5
6
"""
6
7
bg:
11
12
- remove unused imports
12
13
"""
13
14
14
-
15
+ @ final
15
16
class Point (object ):
16
17
17
18
def __init__ (self : Point , i : float ) -> None :
@@ -35,16 +36,15 @@ def maximize(self: Point, other: Point) -> Point:
35
36
self .z = self .z if self .z > other .z else other .z
36
37
return self
37
38
38
-
39
- def maximize (points : List [Point ]) -> Point :
39
+ def maximize (points : CheckedList [Point ]) -> Point :
40
40
next : Point = points [0 ]
41
41
for p in points [1 :]:
42
42
next = next .maximize (p )
43
43
return next
44
44
45
-
45
+ @ inline
46
46
def benchmark (n : int ) -> Point :
47
- points : List [Point ] = [Point ( i ) for i in range (n )]
47
+ points : CheckedList [Point ] = CheckedList [Point ]([ Point ( i ) for i in range (n )])
48
48
for p in points :
49
49
p .normalize ()
50
50
return maximize (points )
You can’t perform that action at this time.
0 commit comments