PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#QHD0000044. Chia hai tập II (Two Sets II)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Chia hai tập II (Two Sets II)
Two Sets II
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
Consider the set . Partition all elements into two disjoint subsets having equal sums. Swapping the two subsets does not produce a different partition. Count the number of distinct partitions modulo .
Input
One line contains integer .
Output
Print the number of partitions modulo .
Subtasks
The independent scoring groups have the following complete constraints:
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Input
7
Output
4
Explanation
The total sum from to is , so both groups must sum to . There are exactly unordered partitions.