csp-c simulation test "set · read ·"

set

answer

Solution only requires one set Laid

Like the same song into the array like

$(sum[r]-sum[l])\%n==0$

Split into $ sum [r] \% n == sum [l] \% n $ bucket deposit $ sum [l] \% n $ $ sum find each [R & lt] $ bucket has no corresponding #sum [ l] #

Deposit $ tong [0] = 1 $, the other first check deposit

prove

Prove correctness

Their legitimate $ 0 $ $ (sum [r] \% n) == 0 $ need not find the corresponding

The other is to find a match

Suppose we have $ n + 1 $ a $ sum '$ value (assumed here $ sum [0] $ is also looking for a match)

$ \ $ SUM runs over the range of $ $ [0, n-1] the significance% n $ $

$ N + 1 $ a $ sum $, $ n $ types of values ​​must have a legitimate

It may therefore permit

 

Guess you like

Origin www.cnblogs.com/znsbc-13/p/11547282.html