Hi Jaap.


There is a situation.


Suppose if a solution has been submitted, but that solutions is not even passing the first test case and the program doesn't terminate. Usually it should be taken care of by DOMjudge right?  Why is it not giving Wrong Answer or TLE. Here is the code:


#include <stdio.h>
#include <math.h>

long long int gcd(long long int a, long long int b)
{
    // base case
    if (b==0)
        {return a;}

    else {return gcd(b,a % b);}
}

long long int PowerSet(int *set, int set_size)
{
    long long int pow_set_size = pow(2, set_size);
    long long int counter, j;
    long long int first=0,result=1;
    long long int proresult=1;

    for(counter = 0; counter < pow_set_size; counter++)
    {
      for(j = 0; j < set_size; j++)
       {
          if(counter & (1<<j))
            {
                if(first==0)
                {
                //printf("\nFIRST%dFIRST\n",set[j]);
                    result=set[j];
                }
                printf("%d ", set[j]);
                first++;
                result=gcd(result, set[j]);
            }

       }
       first=0;proresult=(proresult%1000000007*result%1000000007)%1000000007;
       printf(" GCD %lld",result);printf("\n");
    }
    return proresult;
}

int main()
{
    int t=0,T;
    scanf("%d",&T);
    while(t<T)
    {
        int n,i,a[100002];
        long long int ans;
        scanf("%d",&n);
        for(i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
        }
        ans=PowerSet(a, n);

        printf("%lld\n",ans%1000000007);
        t++;
    }
    return 0;
}