:py:mod:`oioioi.acm.score` ========================== .. py:module:: oioioi.acm.score Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.acm.score.BinaryScore oioioi.acm.score.ACMScore Functions ~~~~~~~~~ .. autoapisummary:: oioioi.acm.score.format_time .. py:function:: format_time(seconds) .. py:class:: BinaryScore(solved=False) Bases: :py:obj:`oioioi.contests.scores.ScoreValue` Score representing binary grading: accepted or rejected. Sum of binary scores is accepted only when every single score were accepted. .. py:attribute:: symbol :annotation: = bool .. py:attribute:: accepted :annotation: = False .. py:method:: __add__(other) Implementation of operator ``+``. Used for example when creating user result for round based on scores from all problems of the round. Must be overridden in all subclasses. .. py:method:: __eq__(other) Implementation of operator ``==``. Used to produce ranking, being greater means better result. Must be overridden in all subclasses. .. py:method:: __lt__(other) Implementation of operator ``<``. Used to produce ranking, being greater means better result. Must be overridden in all subclasses. .. py:method:: __hash__() Return hash(self). .. py:method:: _from_repr(value) :classmethod: Creates an instance based on data from :meth:`_to_repr`. Must be overridden in all subclasses. .. py:method:: _to_repr() Returns score data serialized to string, without the class's symbol. Must be overridden in all subclasses. Lexicographical order of serialized data has to correspond to the given by :meth:`__eq__` and :meth:`__lt__`, it will be used for sorting at db level. .. py:method:: __unicode__() Returns string representing score, suitable to display to the user. Must be overridden in all subclasses. .. py:method:: to_int() .. py:class:: ACMScore(problems_solved=0, time_passed=0, penalties_count=0) Bases: :py:obj:`oioioi.contests.scores.ScoreValue` ACM style score consisting of number of solved problems, total time needed for solving problems and time penalty for each unsuccessful submission. NOTE: When adding :class:`ACMScore`s only scores with positive :attr:`problems_solved` are considered to avoid adding :attr:`time_passed` or :attr:`penalties_count` when :attr:`problems_solved` equals zero. That's because ACM ICPC rules states that team doesn't obtain any penalty for nonsolved problems. .. py:property:: total_time .. py:attribute:: symbol :annotation: = ACM .. py:attribute:: problems_solved :annotation: = 0 .. py:attribute:: time_passed :annotation: = 0 .. py:attribute:: penalties_count :annotation: = 0 .. py:attribute:: penalty_time .. py:method:: __add__(other) Implementation of operator ``+``. Used for example when creating user result for round based on scores from all problems of the round. Must be overridden in all subclasses. .. py:method:: __eq__(other) Implementation of operator ``==``. Used to produce ranking, being greater means better result. Must be overridden in all subclasses. .. py:method:: __lt__(other) Implementation of operator ``<``. Used to produce ranking, being greater means better result. Must be overridden in all subclasses. .. py:method:: __hash__() Return hash(self). .. py:method:: __unicode__() Returns string representing score, suitable to display to the user. Must be overridden in all subclasses. .. py:method:: csv_repr() .. py:method:: penalty_repr() .. py:method:: total_time_repr() .. py:method:: time_passed_repr() .. py:method:: _from_repr(value) :classmethod: Creates an instance based on data from :meth:`_to_repr`. Must be overridden in all subclasses. .. py:method:: _to_repr() Store score as string ``"ACM:problems_solved:total_time:penalties_count"`` where: ``problems_solved`` is number of problems solved, ``total_time`` is total number of seconds needed to solve problems, ``penalties_count`` is number of unsuccessful submissions. .. py:method:: to_int()