SP18964 BLSUMSEQ - Sum of subsequences
Description
[English](/problems/BLSUMSEQ/en/) [Vietnamese](/problems/BLSUMSEQ/vn/)Given an positive integer n and a sequence a $ _{1} $ …a $ _{n.} $ There are q queries. Each query has one of two formats :
\- Format 0 l r k : you need to output the k-th smallest positive integer that can’t be partition into a sum of any subsequence of a $ _{l} $ ...a $ _{r } $
\- Format 1 l r x : you need to output the numbers of ways to partition x into a sum of a subseqence of a $ _{l} $ ...a $ _{r} $ (or the numbers of subsequence that sum of all its elements equal to x) (modulo 2 $ ^{32} $ )
**Input :**
\- Fist line : two positive n and q (1
\- Second line : n positive a $ _{1} $ …a $ _{n } $ (0
\- Next q lines : each line denotes a query with one of two format listed above (1
**Output :**
\- q lines : the i-th line is the answer of i-th query.
**Sample :**
**Input :**
5 3
1 0 2 4 1
0 2 3 2
Input Format
N/A
Output Format
N/A