low_'s blog

By low_, history, 6 years ago, In English

Recently, I find there are many interesting interactive problems on many platforms, including Codeforces. Usually, the example testcases and generated cases are rather small and it is easy for me to type in and test it directly on the C++ IDE console. But, if the tests are as big as in 1100D - Dasha and Chess, I can't afford to spend hours typing that in (who does that anyway ==). Of course test it directly by submitting it is a solution to this problem, but what if there is a small bug in my code, how can I find it?

I find this blog rather interesting: https://codeforces.me/blog/entry/49490. It said something about the Croupier (the Interactor), which is exactly what I'm looking for. But it is implemented in Python, so there are many unknown syntax for me, and I'm unable to translate it to C++ to use. Can anyone help me out?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

If you mean you just want to test your program on given jury's input that does not depend on your answers, you could simply create input.txt and read it from here. If jury's input does depend on your answers, but in the simple known way (for this test) (such as interactive binary search problem), you could write your own interactor (just calculate jury's answers inside your code). Otherwise there is no better solution rather than typing.

  • »
    »
    6 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    How to implement an interactor in C++??

    • »
      »
      »
      6 years ago, # ^ |
      Rev. 2   Vote: I like it +8 Vote: I do not like it

      Perhaps I shouldn't use such a strong word. I just said, rather then write cin >> juryInput you could write juryInput = foo(yourAnswer) if you could deduce or assume this function foo for given problem/test.