Sort by

recency

|

25 Discussions

|

  • + 0 comments

    When it comes to accessibility, the GCD Matrix ensures inclusivity, catering to all users regardless of their device preferences. Whether you're accessing it through Explore Castle for TV on your Android smartphone or tablet, rest assured, the experience remains seamless and enjoyable. There's no need to worry about compatibility issues; the GCD Matrix is designed to provide smooth streaming, making it your ultimate entertainment companion.

  • + 0 comments

    As per the current trends, people are always showing their interest in watching the Movies, TV shows, cartoons and more. Well, entertainment is playing the crucial role among the general people where everybody used to experience after loads of work. If you are a moviegoer, then you can find a lot of applications which will offer to watch HD movies and TV shows. For those people, Cartoon HD Apk is the best choice to utilize.

    Do Visit: https://techthatmatter.com/cartoon-hd-apk/

  • + 0 comments

    township cheats that work

  • + 1 comment

    I feel determined about the correctness of the code. Don't know why it shows "Wrong Answere" after testcase 3.I shall be gratefull to who explains the awesome magic involved.

    public class Solution { static HashMap G=new HashMap();

    public static int gcd(int x, int y){
        int z=0;
        if(x==0)z=y;
        if(G.get(x*100000+y)!=null)
        z=G.get(x*100000+y);
    
        if(z==0)
        z=gcd(y%x,x);
        G.put(x*100000+y,z);
    
        return z;
    
    }
    
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int q = in.nextInt();
        int[] a = new int[n];
        for(int a_i=0; a_i < n; a_i++){
            a[a_i] = in.nextInt();
        }
        int[] b = new int[m];
        for(int b_i=0; b_i < m; b_i++){
            b[b_i] = in.nextInt();
        }
        int M[][]=new int[n][m];
            for(int i=0;i<n;i++)
                for(int j=0;j<m;j++)
                    M[i][j]=gcd(a[i],b[j]);
    
        for(int a0 = 0; a0 < q; a0++){
            int r1 = in.nextInt();
            int c1 = in.nextInt();
            int r2 = in.nextInt();
            int c2 = in.nextInt();
            // your code goes here
             HashSet<Integer> G1=new HashSet<Integer>();
             for(int i=r1;i<=r2;i++)
                for(int j=c1;j<=c2;j++)
                    G1.add(M[i][j]);
            System.out.println(G1.size());
            G1.clear();
    
        }
    
    
    
    
    
    
    }
    

    }

  • + 0 comments

    code got timed out...please suggest improvements for a more efficient algorithm...thanks in advance! :)

    int gcd(int a,int b){

    if(a>b && b!=0) return gcd(a%b,b); if(b>a && a!=0) return gcd(a,b%a);

    if(a==0)
        return b;
    else return a;
    

    } int main(){ int n; int m; int q; scanf("%d %d %d",&n,&m,&q); int *a = malloc(sizeof(int) * n); for(int a_i = 0; a_i < n; a_i++){ scanf("%d",&a[a_i]); } int *b = malloc(sizeof(int) * m); for(int b_i = 0; b_i < m; b_i++){ scanf("%d",&b[b_i]); } for(int a0 = 0; a0 < q; a0++){ int r1; int c1; int r2; int c2; scanf("%d %d %d %d",&r1,&c1,&r2,&c2);

        int matrix[n][m];
    
        for(int i=0;i<n;i++)
            for(int j=0;j<m;j++)
            matrix[i][j]=gcd(a[i],b[j]);
    
    
    
            int distinct=1;
    
        int arr[(r2-r1+1)*(c2-c1+1)];
    
        int k=0;
    
        for(int i=r1;i<=r2;i++){
            for(int j=c1;j<=c2;j++){
    
             arr[k]=matrix[i][j]-matrix[r1][c1];
                k++;
            }
    
        }
    
    
       int j;
    
    
         for(int i=1;i<k;i++){
            int temp=arr[i];
            j=i-1;
            while(j>=0&&temp<arr[j]){
                arr[j+1]=arr[j];
                j--;
                arr[j+1]=temp;
    
            }
        }
    
    
    
         int max=0;
        distinct=1;
        for(int i=0;i<k;i++)
            if(arr[i]>max){
            max=arr[i];
            distinct++;
    
        }
        int minimum=0;
        for(int i=0;i<k;i++)
            if(arr[i]<minimum){
            minimum=arr[i];
            distinct++;
        }
    
         printf("%d\n",distinct);
    
       }
    return 0;
    

    }