You are viewing a single comment's thread. Return to all comments →
what is wrong in my solution ? #include<bits/stdc++.h>
using namespace std;
int main() { bool table[10000]; memset(table,true,sizeof(table)); for(ll i=2;i*i<=10000;i++) { if(table[i]==true) { for(ll j=i*i;j<=10000;j+=i) table[j]=false; } } ll t; cin>>t; testcase { int n; cin>>n; ll a[n]; mapmap2; ll count=0; map::iterator it; for(ll i=0;i>a[i]; }
ll prev=0;
ll b[n+1]; b[-1]=0; for(ll i=0;i<=n;i++) { b[i]=(a[i]^prev); prev=a[i]; }
for(ll i=0;i<=n;i++) { for(ll j=i;j<=n;j++) { if(table[b[j]^b[i-1]]) map2[b[j]^b[i-1]]++; } }
cout<<(count%mod+map2.size()%mod)%mod<<"\n"; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Prime XOR
You are viewing a single comment's thread. Return to all comments →
using namespace std;
define ll long long int
define testcase while(t--)
define mod 1000000007
int main() { bool table[10000]; memset(table,true,sizeof(table)); for(ll i=2;i*i<=10000;i++) { if(table[i]==true) { for(ll j=i*i;j<=10000;j+=i) table[j]=false; } } ll t; cin>>t; testcase { int n; cin>>n; ll a[n]; mapmap2; ll count=0; map::iterator it; for(ll i=0;i>a[i]; }
ll b[n+1]; b[-1]=0; for(ll i=0;i<=n;i++) { b[i]=(a[i]^prev); prev=a[i]; }
cout<<(count%mod+map2.size()%mod)%mod<<"\n"; } }