 # WA in CAKEDOOM

https://www.codechef.com/viewsolution/28600709

I have tried and passed all the test cases i could have thought of, but some how i am still getting WA.

Randomly failing testcase:

``````1
2
?10??10101010?0101?0?1?1?10101010?0?0?0?1?01?101?10?0101
``````

Oh thanks a lot!!
can you pls help me , i want to know how you generate large test cases for a given problem.

Depends on the Problem - for this one, I just used:

``````#include <iostream>
#include <string>
using namespace std;

#include <sys/time.h> // TODO - this is only for random testcase generation.  Remove it when you don't need new random testcases!

int main(int argc, char* argv[])
{
ios::sync_with_stdio(false);
if (argc == 2 && string(argv) == "--test")
{
struct timeval time;
gettimeofday(&time,NULL);
srand((time.tv_sec * 1000) + (time.tv_usec / 1000));

const int T = 1;
cout << T << endl;

for (int t = 0; t < T; t++)
{
const int K = 1 + rand() % 10;
const int strLen = 1 + rand() % 100;

const bool forceGenerateYES = ((rand() % 4) == 0);

string s;
for (int i = 0; i < strLen; i++)
{
int val = rand() % (K + 1);
if (forceGenerateYES && val != K)
{
if (i > 0 && val == s[i - 1] - '0')
if (i == strLen - 1 && val == s - '0')
}
{
if (val == 0)
val++;
else
val--;
}
if (val == K)
s += '?';
else
s += ('0' + val);

}
cout << K << endl;
cout << s << endl;
}

return 0;
}
}
``````
1 Like

ok thanks!

1 Like