in Pairwise AND sum problem from school catagory there are sub tasks like
Subtask 1 (13 points): N <= 1000, Ai <= 1.
Subtask 2 (39 points): N <= 1000, Ai <= 109.
Subtask 3 (21 points): N <= 105, Ai <= 1.
Subtask 4 (27 points): N <= 105, Ai <= 106.
my code is
#include <stdio.h>
int main()
{
long long int n,i,m,x,j;
scanf("%lld", &n);
long long int ara[n+1];
for(i = 0;i<n;i++)
scanf("%lld", &ara[i]);
m = 0;
for(i=0;i<n;i++) {
for(j=0;j<n;j++) {
if(ara[i] < ara[j])
m = m + (ara[i]&ara[j]);
}
}
printf("%lld\n",m);
return 0;
}
it shows i’ve only done sub task 2 … others are not done … i don’t understand why.can anyone plz tell me about this.i am new.