Judge error for all solutions in roadmap to 3* track

Describe your issue

When I run the problem on the CodeChef IDE, I get a “Judge Error” after submission. I am using the interactive problem approach where the system provides responses to my guesses. The code works fine in local tests, and the input/output handling is implemented with proper flushing of the output.

Screenshot

https://www.codechef.com/learn/course/rcpit-roadmap-3star/RCPITRMT33/problems/GUESSIT

Additional info

include <bits/stdc++.h>
using namespace std;

vector sq; // Stores perfect squares

void sieve() {
for (int i = 1; i <= 1000; i++) {
sq.push_back(i * i); // Generate perfect squares
}
}

void Go() {
for (int i = 0; i < sq.size(); i++) {
cout << sq[i] << endl; // Make a guess
cout.flush(); // Flush output immediately
int res = 0;
cin >> res; // Get response

    if (res == 1) {
        return;  // Correct guess, exit
    } else if (res == -1) {
        exit(0);  // Invalid input, exit
    }
}
cout.flush();  // Ensure final output is flushed

}

int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0); // Optimize input/output

sieve();  // Generate all perfect squares from 1 to 1,000,000
int t = 1;
cin >> t;  // Read number of test cases
while (t--) {
    Go();  // Start the guessing process
}

return 0;

}

Sorry for the issue caused. The problem is unsupported, hence you were getting the error. We have removed it from the learning path.

1 Like