Is any Ways To see Codechef Hidden Test Cases just like Codeforces After Contest

Recently I solve a problem and Not found any testcase wrong with my solution and I waste a lot of time figuring it out.
so I feel CodeChef has the feature to see problem Hidden test cases for debugging our code.
Please @admin work on this Problem

4 Likes

This is a reply of the Code-Chef admin from 2012 .

3 Likes

I think after the contest TestCases should be public
By which we debug easily and understand problem Correctly
by which we can’t do that mistake again🙄

5 Likes

Write your own generator and generate as many test-cases you want.

5 Likes

Use this famous test case generator

Generator

2 Likes

if you become pro member of codechef then only you can see hidden test case .

i have taken above picture from codechef official site…

#include<bits/stdc++.h>
using namespace std;
int mycode(int arr,int n){
long long ans = 0;
int x = min(30, n);
for (int i = 0; i < n; i++) {
if (arr[i] == 1) {
ans += n;
continue;
}
for (int j = 1; j < x; j++) {
if (pow(arr[i], j) <= arr[j - 1])
ans++;
}
}
return ans;
}
int correctcode(int arr,int n){
long long ans = 0;
int x = min(30, n);
for (int i = 0; i < n; i++) {
if (arr[i] == 1) {
ans += n;
continue;
}
for (int j = 1; j <= x; j++) {
if (pow(arr[i], j) <= arr[j - 1])
ans++;
}
}
return ans;
}
int main(){
srand(time(NULL));
int t=(rand()%1000000000)+1;
for(int i=0;i<t;i++){
int n=(rand()%200000)+1;
int arr[n];
for(int j=0;j<n;j++){
arr[j]=(rand()%1000000000)+1;
}
int correctoutput=correctcode(arr,n);
int myoutput=mycode(arr,n);
if(correctoutput!=myoutput){
cout<<n<<“\n”;
for(int j=0;j<n;j++){
cout<<arr[j]<<" ";
}
}
}
}
You can use this to generate the testcases at which your code is failing. In the mycode function you can replace it with your code and in the correct code section you can either use brute force approach or some other accepted code.

And you can adjust the input as mentioned in the problem by just using (rand()%constraint)+1 instead of taking input and store it in the particular places.

If you want to more about the above code.
You can refer to this video:https://www.youtube.com/live/iYxjjMyonvk?si=qO3bJNO8JzgS1Iaz