← All problemsSign in

4 - Minimum Division Permutations

Given two arrays $A$ and $B$, both of length $N$ and consisting of only positive integers, your task is to find the number of permutations $P$ of length $N$ such that $\sum_{i=1}^{N} A_{i}/B_{P_{i}}$ is minimum. Since the number of such permutations can be large, print the answer modulo $998244353$. The sequence of $N$ integers is called a permutation if it contains all integers from $1$ to $N$

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start