Source code for oioioi.mp.score
from functools import total_ordering
from oioioi.contests.scores import ScoreValue
@total_ordering
[docs]class FloatScore(ScoreValue):
def __init__(self, value):
assert isinstance(value, float) or isinstance(value, int)
self.value = float(value)
[docs] def __add__(self, other):
if not isinstance(other, FloatScore):
return FloatScore(self.value + other)
return FloatScore(self.value + other.value)
[docs] def __mul__(self, other):
if not isinstance(other, FloatScore):
return FloatScore(self.value * other)
return FloatScore(self.value * other.value)
[docs] def __eq__(self, other):
if not isinstance(other, FloatScore):
return self.value == other
return self.value == other.value
[docs] def __lt__(self, other):
if not isinstance(other, FloatScore):
return self.value < other
return self.value < other.value
@classmethod