Is there some way to print output orderly for different test files ?

Suppose there is a problem whose output is known to be a single digit number, the problem supports partial scoring and there are n test files( not test cases but files) . Now I can submit programs each printing a number in the range[0-9] and know the answer for each of the n test files.

Let’s say the output for test file 1,2,3 are 5,7,3 respectively.
Now is there some way that when i run the program for different files, the output will also be different independent of the input.

One way of doing this would be to write a program which stores a list of the outputs and randomly prints one of them … and then submitting this program many times until the sequence of outputs matches correctly.
That would be :

srand(time(NULL));
 int a[3]={5,7,3};
cout<<a[rand()%2];

What I exactly want to do is print the 0th element of array a in the first run , 1st element in the second run , and so on !!

Is there some sophisticated way of doing this?

Yes, It is possible but really difficult and you must also have mastery in hashing.

Here and here @mugurelionut explains his method for finding info about test cases and using hashing to correctly answer them.

1 Like