Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from time import time
- import os
- from sys import stdout
- from colorama import init, Fore;
- init()
- start=time()
- os.system("cmd /c cf < input.txt > output.txt")
- end=time()
- with open("correct_output.txt") as correct:
- lines_correct = correct.readlines()
- with open("output.txt") as mine:
- lines_mine = mine.readlines()
- print()
- with open("input.txt") as inp:
- inp_lines = inp.readlines()
- print("Input:")
- for inp_line in inp_lines:
- print(inp_line, end='')
- print()
- print("Expected output:")
- for line in lines_correct:
- print(line, end='')
- print()
- print("Output:")
- for line in lines_mine:
- print(line, end='')
- print('\n')
- if(lines_correct==lines_mine):
- stdout.write(f"{Fore.GREEN}CORRECT ANSWER{Fore.RESET}\n\n")
- else:
- stdout.write(f"{Fore.RED}WRONG ANSWER{Fore.RESET}\n\n")
- print("Time:", round((end-start)*1000), "ms")
Advertisement
Add Comment
Please, Sign In to add comment