pyrival.misc¶
pyrival.misc.FastIO¶
-
class
pyrival.misc.FastIO.FastIO(file)¶ Bases:
io.IOBase-
flush()¶ Flush write buffers, if applicable.
This is not implemented for read-only and non-blocking streams.
-
newlines= 0¶
-
read()¶
-
readline()¶ Read and return a line from the stream.
If size is specified, at most size bytes will be read.
The line terminator is always b’n’ for binary files; for text files, the newlines argument to open can be used to select the line terminator(s) recognized.
-
-
class
pyrival.misc.FastIO.IOWrapper(file)¶ Bases:
io.IOBase
-
pyrival.misc.FastIO.input()¶
-
pyrival.misc.FastIO.str(x=b'')¶
pyrival.misc.Random¶
pyrival.misc.alphabeta¶
-
class
pyrival.misc.alphabeta.AlphaBetaNode(value=None, children=None)¶ Bases:
object
-
pyrival.misc.alphabeta.alphabeta(node, depth, alpha=-inf, beta=inf, maximizingPlayer=True)¶
pyrival.misc.bit_hacks¶
-
pyrival.misc.bit_hacks.least_bit(x)¶
-
pyrival.misc.bit_hacks.next_mask(x)¶
-
pyrival.misc.bit_hacks.subset_masks(m)¶
-
pyrival.misc.bit_hacks.sum_of_subsets(K, D)¶
pyrival.misc.memoize¶
-
pyrival.misc.memoize.memodict(f)¶ Memoization decorator for a function taking a single argument.
-
pyrival.misc.memoize.memoize(f)¶ Memoization decorator for a function taking one or more arguments.
pyrival.misc.mod¶
pyrival.misc.order_statistic¶
-
pyrival.misc.order_statistic.order_statistic(a, k)¶ returns the k-th (0 <= k < len(a)) largest element of a
pyrival.misc.ordersort¶
-
pyrival.misc.ordersort.bucketsort(order, seq)¶
-
pyrival.misc.ordersort.long_ordersort(order, seq)¶
-
pyrival.misc.ordersort.multikey_ordersort(order, *seqs, sort=<function ordersort>)¶
-
pyrival.misc.ordersort.ordersort(order, seq, reverse=False)¶
pyrival.misc.py3k¶
Python 3 compatibility tools.