Guest User

Evaluator

a guest
Apr 25th, 2022
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. from time import time
  2. import os
  3. from sys import stdout
  4. from colorama import init, Fore;
  5.  
  6. init()
  7.  
  8. start=time()
  9.  
  10. os.system("cmd /c cf < input.txt > output.txt")
  11.  
  12. end=time()
  13.  
  14. with open("correct_output.txt") as correct:
  15.     lines_correct = correct.readlines()
  16. with open("output.txt") as mine:
  17.     lines_mine = mine.readlines()
  18.  
  19. print()
  20.  
  21. with open("input.txt") as inp:
  22.     inp_lines = inp.readlines()
  23.  
  24. print("Input:")
  25. for inp_line in inp_lines:
  26.     print(inp_line, end='')
  27. print()
  28.  
  29. print("Expected output:")
  30. for line in lines_correct:
  31.     print(line, end='')
  32.  
  33. print()
  34.  
  35. print("Output:")
  36. for line in lines_mine:
  37.     print(line, end='')
  38.  
  39. print('\n')
  40.  
  41. if(lines_correct==lines_mine):
  42.     stdout.write(f"{Fore.GREEN}CORRECT ANSWER{Fore.RESET}\n\n")
  43. else:
  44.     stdout.write(f"{Fore.RED}WRONG ANSWER{Fore.RESET}\n\n")
  45.  
  46. print("Time:", round((end-start)*1000), "ms")
  47.  
Advertisement
Add Comment
Please, Sign In to add comment