Server Time: Mon Oct 26, 2020 6:58 am
Welcome ( logout
B - Increase Unlimited
PDF (English) Ranklist
Time Limit: 2 second(s) Memory Limit: 32 MB

Problem Statement:

You are given a String[] digits. Concatenate the elements of digits to get one large string. Then, insert spaces to divide it into a list of strictly increasing integers (leading zeros are allowed). If there are multiple ways to do this, minimize the last integer. If there are still multiple solutions, maximize the first integer. If multiple solutions still remain, maximize the second integer, then the third one, etc. Return the product of all the integers in the list, modulo 1,000,000,003.

Notes

-     Two integers that differ only by the number of leading zeros they contain (for example, 0123  and 00123, or 95 and 00095) are considered equal (i.e., neither of them is less than the other).

 

Constraints

-     Digits will contain between 1 and 50 elements, inclusive.

-     Each element of digits will contain between 1 and 50 characters, inclusive.

-     Each element of digits will contain digits ('0'-'9') only.

-     The first character of the first element of digits will not be '0'.

Sample Input

3

12345

543210

20210222

Sample Output

120

45150

932400


Problem Setter: Utpal
Developed and Maintained by
JANE ALAM JAN
Copyright © 2012
LightOJ, Jane Alam Jan