Are These Equal
All submissions for this problem are available.You are given an array $A$ consisting of $N$ Integers which are initially all $0$. You are also given an array $B$ consisting of $N$ Integers. You have to tell whether you can make $A$ equal to $B$ or not by performing the following operation any number of times. In one operation you can choose exactly $K$ distinct indices in the array A and increase the value at these indices by $1$. ###Input: - First line will contain $T$, the number of testcases. Then the testcases follow. - Each testcase contains two lines of input. - First line contains two Integers $N$ and $K$. - Second line contains $N$ Integers denoting array $B$. ###Output: For each testcase, output in a single line YES if $A$ can be converted to $B$, otherwise print NO. ###Constraints - $1 \leq T \leq 1000$ - $1 \leq N \leq 10^5$ - $1 \leq K \leq N$ - $1 \leq B[i] \leq 10^9$ - Sum of N over all Testcases does not exceed $10^6$. ###Sample Input: 2 5 3 5 4 3 2 1 3 2 4 1 1 ###Sample Output: YES NO
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, CPP17, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.