Yucy's blog

By Yucy, history, 3 years ago, In English

Generating test cases is no stranger with cp-er, especially in offline competition (such as Olympic...)

Today I also have one question about this skill. Specifically, I want to ask about bat file

When I want to generate and compare brute forces code and AC code, I create one bat file and put these commands and run by cmd

generator.exe

full.exe

slow.exe

fc /w output.out output.txt, where output.out is output of AC code and output.txt is output of brute forces code.

I have some questions about this bat file:

  1. Do you have any commands that instead of running this file bat one by one by cmd (then it will run the above 3 exe files and compare the answers once time), I can run any number of times I want then it will compare these codes many times for me ?

  2. If yes, how can I stop when two codes have different answers, as I want to see and take the test case that I have the wrong answer.

  3. With you, do you have a more convenient way to compare brute and full code ? Can you share it with me and everyone ?

Thanks for helps

  • Vote: I like it
  • -2
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it +4 Vote: I do not like it

You can use for loop in bash for running multiple files in command lines like let's say your file name.is abc$var$ here on var you can put number. Once before hashcode of past year i guess errichto(Kamil) has made a video there you can see it.

»
3 years ago, # |
  Vote: I like it +10 Vote: I do not like it

You could try doing something like this.

@echo off
:loop
generator.exe
full.exe
slow.exe
fc /w output.out output.txt
IF %ERRORLEVEL% NEQ 0 EXIT 1
goto loop
  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Thanks ! It really works, convenient and easy for me to adjust bat file <3