I was trying to attempt this QUESTION but it was repeatedly giving me Runtime error after every submission even though I was sure there’s nothing wrong with my code. I tried submitting this piece of code:
#include <iostream>
#include <cmath>
int sieve[1000001];
int main() {
int sz = 1000001;
std::fill(sieve, sieve+sz, 1);
int T;
std::cin >> T;
while (T--) {
int N;
std::cin >> N;
N%2==0 ? std::cout << "1\n" : std::cout << sieve[N] << "\n";
}
return 0;
}
This in no way should have raised a runtime error so what I did was picked a solution that scored ac and copy-pasted it and submitted it and again I got a runtime error. Can anybody help me with what’s wrong here? Here the screenshot shows the copy-pasted solution showing a runtime verdict and the original one showing AC verdict.