## DMOPC '21 Contest 4 P3 - Palindromic Presents

View as PDF

Points: 12 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

Petep is preparing a Christmas present for Reter! As they both love palindromes, Petep decides to gift Reter a set of distinct non-negative palindromic integers. To make the best possible present, Petep decides that the sum of any subset of these integers (including the sum of all integers) should also be a palindrome, and the sum of the integers should be as small as possible to ensure that they fit under the Christmas tree. Please help Petep find any set of integers satisfying these properties.

#### Input Specification

There is no input for this problem.

#### Output Specification

Output non-negative integers each on its own line, the set of integers in Petep's present.

#### Scoring

If your output is improperly formatted, the sum of all integers exceeds , the integers are not all distinct, or the sum of any subset of the integers is not a palindrome, you will receive points.

Otherwise, let be the sum of the integers in your solution, and let be the sum of the integers in the best possible solution.

If , you will receive full points. Otherwise, you will receive a positive number of points based on how close is to . It is guaranteed that a solution with a larger will not score more points than a solution with a smaller .

#### Sample Output

2
7
18281
828
4
161
8
0
33
9

#### Explanation

This output is only provided to clarify the output format. Note that it would score points because, for example, is not a palindrome.