Problem

Source: Peruvian IMO TST 2019, P6

Tags: algebra, Sets



Let $p$ and $q$ two positive integers. Determine the greatest value of $n$ for which there exists sets $A_1,\ A_2,\ldots,\ A_n$ and $B_1,\ B_2,\ldots,\ B_n$ such that: The sets $A_1,\ A_2,\ldots,\ A_n$ have $p$ elements each one. The sets $B_1,\ B_2,\ldots,\ B_n$ have $q$ elements each one. For all $1\leq i,\ j \leq n$, sets $A_i$ and $B_j$ are disjoint if and only if $i=j$.