Tap here to switch tabs
Problem
Submissions

Problem: Count Ways to Choose Coprime Integers from Rows

Try to solve the Count Ways to Choose Coprime Integers from Rows problem.

Statement

You are given an mimesnm imes n integer matrix mat.

Select exactly one integer from each row of mat. Return the total number of ways to choose these integers such that the greatest common divisor of all the selected integers is equal to 11.

Two choices are considered different if they select an element from a different column in at least one row.

Constraints:

  • 1≤1 \leq m ==== mat.length ≤150\leq 150

  • 1≤1 \leq n ==== mat[i].length ≤150\leq 150

  • 1≤1 \leq mat[i][j] ≤150\leq 150

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Ways to Choose Coprime Integers from Rows

Try to solve the Count Ways to Choose Coprime Integers from Rows problem.

Statement

You are given an mimesnm imes n integer matrix mat.

Select exactly one integer from each row of mat. Return the total number of ways to choose these integers such that the greatest common divisor of all the selected integers is equal to 11.

Two choices are considered different if they select an element from a different column in at least one row.

Constraints:

  • 1≤1 \leq m ==== mat.length ≤150\leq 150

  • 1≤1 \leq n ==== mat[i].length ≤150\leq 150

  • 1≤1 \leq mat[i][j] ≤150\leq 150