| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | strapple | 3515 |
| 6 | tourist | 3470 |
| 7 | dXqwq | 3436 |
| 8 | Radewoosh | 3415 |
| 9 | Otomachi_Una | 3413 |
| 10 | Um_nik | 3376 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | adamant | 152 |
| 3 | Proof_by_QED | 146 |
| 3 | Um_nik | 146 |
| 5 | Dominater069 | 144 |
| 6 | errorgorn | 141 |
| 7 | cry | 139 |
| 8 | YuukiS | 135 |
| 9 | chromate00 | 134 |
| 9 | TheScrasse | 134 |
|
0
this hidden text is supposed to be a trap for LLM users, why are you asking this? |
|
0
Will there be any prizes? |
|
+20
wouldn't starting with 1 just mean that you can't put any other number in the array? (all numbers are divisible by 1) |
|
+4
I think you have to choose between that or first n primes, for example in n = 5 [5, 6, 7, 8, 9] = 35 [2, 3, 5, 7, 11] = 28 at some point maybe the former construction will be lower than first N primes as N gets larger? but I can't prove it myself just yet, though it is the only other sensible construction I can think of |
|
0
The culprit is the line for example in the sample testcase, you're trying to turn the string "1024 512 64 512" (the numbers are given in one line) into an to split the string (default delimiter is " ") and go through each number. also as a general tip, whenever you run into a Runtime Error, using custom invocation gives you more info on what your code is doing. |
|
+4
When finding the number of solutions in the range [L,R], we can rewrite it as $$$f(R)-f(L-1)$$$ where $$$f(x)$$$ is a function that returns the number of lucky numbers from 1 to x. Now, the next step for us is to define $$$f(x)$$$. Hint A key insight to solving this problem is to find what makes a number not lucky So how do we define f(x)? (solution) Let's try to do small numbers, trivially for 1-digit numbers, let's group them into their values mod 3 n ≡ 0 (mod 3) [0,3,6,9] n ≡ 1 (mod 3) [1,4,7] n ≡ 2 (mod 3) [2,5,8] this will be useful later but for now we can see that the non-lucky 1-digit numbers are [1,2,4,5,7,8] For 2-digit numbers, we can see that it's actually just 2 1-digit numbers, and if one of those two numbers is in [0,3,6,9], we can just take the substring containing that number making it automatically happy, you can also generalize this for any n-digit number. but what about the numbers not containing any digits in [0,3,6,9]? let x be any number in the set [1,4,7] (x ≡ 1 (mod 3)) and let y be any number in [2,5,8] (y ≡ 2 (mod 3)). This gives is 4 numbers in the form of
Recall the divisibility rule of 3, which states that if the sum of the digits of a number is divisible by three, the number itself is also divisible by 3, let's apply this to the numbers above. xy = 1 + 2 = 0 (mod 3) yx = 2 + 1 = 0 (mod 3) xx = 1 + 1 = 2 (mod 3) yy = 2 + 2 = 1 (mod 3) this means that only numbers in the form of xx and yy are not lucky numbers, which gives us our list of 2-digit non-lucky numbers: [11, 14, 17, 22, 25, 28, 41, 44, 47, 52, 55, 58, 71, 74, 77, 82, 85, 88] Moving on to three digit numbers, we have
We can already eliminate those with xy and yx because we have proven that those are lucky, which leaves us with
let's solve their values xxx = 1 + 1 + 1 = 0 (mod 3) yyy = 2 + 2 + 2 = 0 (mod 3) Therefore, this proves that all 3-digit numbers are lucky and subsequently all n-digit numbers (n>3) are also lucky. (because any n-digit number contains a 3-digit number) So we have 24 non-lucky numbers [1, 2, 4, 5, 7, 8, 11, 14, 17, 22, 25, 28, 41, 44, 47, 52, 55, 58, 71, 74, 77, 82, 85, 88] We then just check for each number in this list if they are inside the range of x in f(x), and subtract one if true. Python Solution P.S this is my first time writing something like this, if there are some improvements I can do please tell me ^ ^ |
|
+10
could be that it doesn't take timezones into account -w- see you in 5 hours then ww |
|
+10
I also cannot enter, however when looking at the telegram channel it seems like the contest is in 26 Aug 18:00 UTC+3; so it is still 5 hours away from now? |
|
0
Use PyPy instead of Python3 |
| Name |
|---|


