Stuck in problem 230B — need help!

Revision en1, by green-eyeliner, 2024-02-02 15:35:40

I was recently trying to solve problem 230B - T-primes and I'm getting WA on test 8, I don't know why. Also the solution comes out correct in my local compiler. I need help. attaching the solution. 244541266 ~~~~~

include<bits/stdc++.h>

using namespace std;

define ll long long

define vv vector

define map map<long long, long long>

define mapllc map<long long, char>

define mapcll map<char, long long>

define set set

define loop0 for(ll i=0; i<n ; i++)

define loop1 for(ll i=1; i<n; i++)

int main(){ bool sieve[1000001]; sieve[0]=sieve[1]=false; ll m = 1000000; for(int i = 2; i<=m; i++){ sieve[i]= true; } for(int i = 2; i*i<=m; i++){ if(sieve[i]==true){ for(int j = i*i; j<=m; j+=i){ sieve[j]=false; } } } ll n; cin>>n; vv arr(n); loop0{ ll temp; cin>>temp; if((temp)==(sqrt(temp)*sqrt(temp))) arr[i] = sqrt(temp); else arr[i] = 0; } loop0{ if(sieve[arr[i]]==true) cout<<"YES"<<endl; else cout<<"NO"<<endl; } } ~~~~~

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English green-eyeliner 2024-02-02 15:36:58 878
en1 English green-eyeliner 2024-02-02 15:35:40 1138 Initial revision (published)