How to use dmoj - 1 common examples

To help you get started, we’ve selected a few dmoj examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DMOJ / docs / problem_examples / interactive / seed2 / seed2.py View on Github external
from dmoj.graders.interactive import InteractiveGrader

class Grader(InteractiveGrader):
    def interact(self, case, interactor):
        N = int(case.input_data())
        guesses = 0
        guess = 0
        while guess != N:
            guess = interactor.readint(1, 2000000000)
            guesses += 1
            if guess == N:
                interactor.writeln('OK')
            elif guess > N:
                interactor.writeln('FLOATS')
            else:
                interactor.writeln('SINKS')
        return guesses <= 31

dmoj

The judge component of the DMOJ: Modern Online Judge platform

AGPL-3.0
Latest version published 2 years ago

Package Health Score

55 / 100
Full package analysis