Блог пользователя FeiWuLiuZiao

Автор FeiWuLiuZiao, 5 дней назад, По-английски

When to use this:

  • getting Wrong Answer but don't know why, or in a non-real-time-feedback contest and to check whether your code is right
  • have a program to generate random input data
  • for standard problems: have a code that will not output the wrong answer (time limit exceedings are acceptable)
  • for special judge problems (example: problems that allow you to output one of the multiple answers): have a program to check if the answer is right
  • for interactive problems: too weak in coding to know how to use :( if you know, comment below plz ˋ( ° ▽、° )
  • if you are in a contest: make sure you have enough time to write these codes (data generator, bruteforce, checker, etc.)

You should have these files below in the same folder:

  • 1.cpp (or other languages): Your code that got Wrong answer.

  • For standard problems: std.cpp (or other languages): Code that will not output the wrong answer

  • For special judge problems: checker.cpp (or other languages): To check if your output is right, returns 0 in main() if wrong, and returns 1 if correct

  • gen_data.cpp (or other languages): To generate random input data

  • hacker.sh/bat (or other languages that can run bash/cmd command): main program

Details of implementation:

For gen_data.cpp: use mt19937 and chrono::high_resolution_clock().now().time_since_epoch().count() to generate random integer instead of rand() and srand(time(0)). Tutorial of mt19937

For Windows, standard problems, the hacker.cpp: (sorry for not knowing much about batch)

code

For Windows, special judge problems, the hacker.cpp:

code

For Linux/macOS, standard problems, the hacker.sh:

code

For Linux/macOS, special judge problems, the hacker.sh:

code

The main usage of this is to generate small-scale data for debugging.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится