Hi all. I solved TWOSQRS in O(sqrt(n)) but still getting a TLE. It wud be great if someone help me figure out problem with my code
#include
#include
#include<math.h>
using namespace std;
int main()
{
long long int t,n;
cin>>t;
while(t–)
{
cin>>n;int flag=1;
map<long long,int>mp;
for(long long i=1;i<sqrt(n);i++)
{
mp[i*i]=1;
if(mp.find(n-i*i)!=mp.end())
{
cout<<"Yes\n";
flag=0;
break;
}
}
if(flag)
cout<<"No\n";
}
return 0;
}