Блог пользователя atcoder_official

Автор atcoder_official, история, 21 месяц назад, По-английски

We will hold AtCoder Regular Contest 191 (Div. 2).

The point values will be 400-500-600-700-800.

We are looking forward to your participation!

  • Проголосовать: нравится
  • +110
  • Проголосовать: не нравится

»
21 месяц назад, скрыть # |
← Rev. 7  
Проголосовать: нравится +15 Проголосовать: не нравится

Solved problem C after 10 tries, thanks to the corner case $$$2\times p$$$ when $$$p \gt = 3.5 \cdot 10^8$$$

(If $$$n = 2^{a_1}\cdot p_2^{a_2}\cdot p_3^{a_3} ...$$$ then my $$$m$$$ was $$$2^{a_1+2}\cdot p_2^{a_2+1} \cdot p_3^{a_3+1} ...$$$ which was greater than $$$10^{18}$$$)

Edit: this solution is a little crazy and unproved, but seems to work. I bruteforce for that $$$m$$$ to find the first $$$a$$$ such that $$$a^{nk} \equiv 1\ (mod\ m)$$$ and $$$nk$$$ is the smallest. when $$$n = 2^{a_1}\cdot p_2^{a_2}$$$ I chose $$$m = 2^{a_1+1}\cdot p_2^{a_2+1}$$$ instead of $$$m = 2^{a_1+2}\cdot p_2^{a_2+1}$$$

»
21 месяц назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

Bad C. During the contest I used Solution 2 , and it seems that it is much harder than Solution 1. Are you palying brain teasers with us?

»
21 месяц назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

solved D 9 minutes after end....

»
21 месяц назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Solved D by writing a brute force and checking with my solution. Otherwise it's impossible to notice some cases.

»
21 месяц назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

https://atcoder.jp/contests/arc191/submissions/62138147

I passed 63/64. Where did this code go wrong, help me!

»
21 месяц назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

I have an impropriate analogy about today's C and D. Sorry for any insult.

C
D
»
21 месяц назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

The first editorial of C is like apple falling on Newton's head.

»
21 месяц назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

can anyone please help my why i am getting wrong answer in A — Replace Digits here is my submission

»
21 месяц назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

My screencast (in Rust)

»
21 месяц назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

okay, I thought of solution 2 of C during the contest but did not even think about randomized search!

To be honest, I did not find D to be that bad. I solved it after the contest.

»
21 месяц назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone share some insights on how to solve/approach C without pulling the idea out of thin air?

I wrote some brute force and observed that $$$A$$$ was a prime and $$$M$$$ was of form $$$kN + 1$$$ seemed to work. I tried to generate 100 random primes and brute force $$$k$$$, which run okay for $$$N\le10^5$$$. But it didn't for some very big $$$N$$$ like $$$999999001$$$ (due to number overflow).

  • »
    »
    20 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +8 Проголосовать: не нравится

    My thought process (for solution 1 of C), not the nicest way of solving problems but it works: Let's try to find $$$M$$$ first. We know that the multiplicative order of every number modulo $$$M$$$ must be divisible by $$$\varphi(M)$$$ (Euler's totient function). So, $$$N$$$ must divide $$$\varphi(M)$$$. How do we find such an $$$M$$$? Let's look at the formula for Euler's totient function:

    $$$ \varphi(M) = M \prod_{p \mid M} \left( 1 - \frac{1}{p} \right) $$$

    We can probably find a suitable $$$M$$$ by finding the prime factorization of $$$N$$$ and increasing the power of each prime factor by $$$1$$$, but $$$N$$$ and $$$T$$$ are too large (there still exist ways to factorize $$$N$$$ fast enough, but they're rarely seen in contests). An easier way to increase power of each prime factor of $$$N$$$ by at least $$$1$$$ would be using $$$M = N^2$$$. Does it work? Write a bruteforce to find all suitable values of $$$A$$$ for $$$M = N^2$$$ for small $$$N$$$. Observe that $$$N+1$$$ is always present.

    Not a fan of this problem in a programming contest because such ways of solving exist. Seems more suitable for a subjective math contest maybe.

»
21 месяц назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How does one even come up with Solution 1 of problem C?