DMOPC '22 Contest 5 P1 - Triple Triplets

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Russell Westbrook has farmed enough triple doubles in his career and is now pursuing a passion for triple triplets. Let the Triple value of an array A be the number of distinct triplets 1i<j<k|A| such that Ai+Aj=Ak. For example, the Triple value of the array [1,2,10,3] is 1. The only triplet that satisfies this condition is (1,2,4), as A1+A2=A4. Please tell Russell the maximum Triple value of all possible arrays with positive integer values that add up to N.

Constraints

1N106

Subtask 1 [20%]

1N15

Subtask 2 [80%]

No additional constraints.

Input Specification

The first and only line contains the integer N.

Output Specification

Output the maximum Triple value of all possible arrays with positive integer values that add up to N.

Sample Input

Copy
5

Sample Output

Copy
3

Comments

There are no comments at the moment.