#!/usr/bin/env python3 """ Example output validator template for use with Kattis problemtools. Write your own 'validate' function and modify the read_input and read_output functions to parse what is read. """ import math from sys import stdin,argv def report_good_answer(): exit(42) def report_wrong_answer(message, verdict_file): print(message, file=verdict_file) exit(43) def is_eof(input_stream): line = input_stream.readline() if line != "": return False return True def read_input(input_stream, verdict_file): try: the_input = input_stream.readline() tokens = the_input.split(' ') r = int(tokens[0]) s = int(tokens[1]) h = int(tokens[2]) # Maybe do some parsing here and convert the_input into a more useful format. except Exception as e: report_wrong_answer( 'Input could not be read. {}'.format(str(e)), verdict_file) return r, s, h def read_output(input_stream, verdict_file): try: line = input_stream.readline() tokens = line.split(' ') n1 = int(tokens[0]) n2 = int(tokens[1]) n3 = int(tokens[2]) except Exception as e: report_wrong_answer( 'Output could not be read: {}'.format(str(e)), verdict_file) return n1, n2, n3 def gcd(a, b): if b == 0: return a return gcd(b, a%b) def validate(the_input, the_output, judge_output): """Implement this function according to your use case.""" if judge_output is not None: jn1, jn2, jn3 = judge_output n1, n2, n3 = the_output if n1 < 1 or n1 > 1000 or n2 < 1 or n2 > 1000 or n3 < 1 or n3 > 1000: return False, "n1, n2, or n3 is not in the range [1,1000]" if n2<=n1 or n3<=n1 or n3<=n2: return False, "n1,n2,n3 do not satisfy n1