CANDLE - Editorial

PROBLEM LINKS

Practice
Contest

DIFFICULTY

EASY

EXPLANATION

The answer will always be either a repdigit (a number composed of repeated instances of the same digit) or a power of 10. We find the smallest power of 10 that cannot be expressed, and for each digit we find the smallest repdigit that cannot be expressed, and take the smallest of these.

TESTER’S SOLUTION

Can be found here.

4 Likes

I might be mistaken, but this solution is not the desired one. When I run this code in my compiler with the sample input

3

2 1 1 4 0 6 3 2 2 2

0 1 1 1 1 1 1 1 1 1

2 2 1 2 1 1 3 1 1 1

I don’t get the correct answer.

My solution is this one.

Could anyone please tell me why am I getting wrong answer in this solution?
http://www.codechef.com/viewsolution/4147008

I don’t think that a single digit is a repeated instances of same digit so you missed to explain the single digit case.

why am i getting a wrong answer… https://www.codechef.com/viewsolution/9363587

@shubh_ism310, think about the case when zero and another digit has same frequency and this frequency is also the minimum frequency amongst all 10 digits.

If anyone is getting wrong answer try the case
0 2 1 2 2 2 2 2 2
you would be getting the answer as 20
But the correct answer will be 10 :slight_smile: