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

Автор rui_er, история, 2 года назад, По-английски

久别无恙, Codeforces!

We are glad to invite you to take part in Codeforces Round 942 (Div. 1) and Codeforces Round 942 (Div. 2), which will start on Apr/30/2024 17:35 (Moscow time). You will be given 6 problems and 2 hours and 30 minutes to solve them in both divisions. Some problems will be divided into two subtasks.

The problems were authored and prepared by N_z__, _istil, yinhy09 and me rui_er.

We would like to thank:

Score distribution:

  • Div. 2: 500 — 750 — 1500 — (1000 + 1500) — 2500 — 3500
  • Div. 1: 750 — (500 + 750) — 1250 — 1750 — (1750 + 1000) — 3500

We hope you'll like the problemset!

UPD: Congrats to the winners!

Div. 2:

  1. 3_m
  2. RinaRin
  3. eightniko
  4. lmh_qwq
  5. golomb

Div. 1:

  1. tourist
  2. jiangly
  3. EvenImage
  4. gamegame
  5. Kevin114514

Editorial is out.

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

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

Hope to get postive delta!

»
2 года назад, скрыть # |
Rev. 3  
Проголосовать: нравится -16 Проголосовать: не нравится

Looking forward to this high-quality contest.

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

rui_er!

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

As not a tester,I don't know how this round is like.

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

As a problemsetter, hope you have fun!

»
2 года назад, скрыть # |
Rev. 3  
Проголосовать: нравится -26 Проголосовать: не нравится

How hard will this round be? They are known to create hard problems. :/

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

So sad that I can't participate this contest, GLHF

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

Hope for high-quality problems!

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

As a tester,

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

As a tester, I tested

»
2 года назад, скрыть # |
Rev. 2  
Проголосовать: нравится -84 Проголосовать: не нравится

I hope this is a perfect competition.

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

As a tester,I also tested :)

GLHF!

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

I am curious about why this contest changed into div1,div2. I remember it was div1+div2 until yesterday.

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

As we all know, cute rui_er is a kind of ruler.

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

OMG ruler round

She always come back

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

orz _istil

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

rui_er!!!

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

As a tester I don't know what to comment.

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

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

     This is what I acknowledged from Algodoo marble races, so the figure above actually disobeys the rule in Algodoo.

    Purple HSL: [270, 100, 100]

    Violet HSL: [300, 100, 50]

    And, more astonishing, violet belongs to Team Pink, not Team Purple. If we change "L" of violet to 100, we will obtain magenta, which definitely belongs to Team Pink.

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

I like violet :D

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

Good luck & have fun to all participants!

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

Hope I can reach IGM lol

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

As a tester, hope you enjoy the problems!

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

as a Minecraft lover , I hope there is Minecraft in the tutorial

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

SpeedABforces

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

Spent one hour just to realize that the answer for B is long long :v

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

I got AC for problem E one minute after the contest. I enjoyed the problems, thanks

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

As a participant, I will do my best and use all heuristics I know

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

I became CM in today's edu, where shall I register? div 1,2?

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

It would be cool to continue the tradition with photo of authors and coordinator:)

»
2 года назад, скрыть # |
Rev. 5  
Проголосовать: нравится +13 Проголосовать: не нравится

In Edu, many solutions to problem A, including mine, are hacked, because of set.

How is it possible? The time complexity is $$$O(t*n*(n-1)/2*4*log(4)) = O(5*10^7)$$$ which should not work longer, than 2 seconds.

I have solved ABCDE, and would become a master, if my solution to A wasn't hacked :(

Hopefully my solutions will not get hacked in this round.

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

Was the div2 registration intended to close this quickly? Almost 20 hours to go and "registration completed".

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

orz rui_er

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

久别无恙, Codeforces!

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

Why did div1+2 collapse into div1,2?

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

I wish high rating to participants. Best of luck everyone.

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

wow CN Round! Hope I can return home on time :D

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

Seeing "You" in legendary grandmaster colour felt so heartwarming even though I might never get there.

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

Wish get blue!!!!!

»
2 года назад, скрыть # |
Rev. 2  
Проголосовать: нравится -44 Проголосовать: не нравится

Wow,Chinese round!

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

why this c is so difficult

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

As a tester,I look forward to becoming Master.

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

Hope to get violet purple

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

just want to know what does the score distribution (1000 + 1500) mean?

two problems or something else?

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

I have participated in edu round yesterday and rating still not changed yet, If i participated in this round, my rating will change depending on my old rating?

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

Hope everyone will not get stuck in A, B and C.

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

As a Participants and who will enjoyed the problemset, I hope the problemset will be good :)

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

as a tester, hope you enjoy this round. This is certainly a very interesting round and I personally enjoyed it a lot, hope you guys have fun!!!!

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

My first ever Div 1!

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

As a problem writer who wrote rejected problem proposals, GL&HF to everyone!

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

If you like MO this much, you could try asking these on AOPS. That way, non-mathematicians can focus on coding! Leave us some problems!!!

Worst contest I have ever seen!..

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

Can someone answer this please — The rating changes of div2 participants will be made considering the performance of div2 contestants only or the performance of div1+div2 participants combined ?

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

i spent more time thinking about B2 than any of CDE.... I even had to use OEIS as a crutch for B2 (https://oeis.org/A063647 is the number of possible $$$y$$$ for each $$$x$$$) cause im too stupid at NT

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

Tfw I spend nearly two hours sitting in one place at D2. Always feeling so close, then turning out that I got nothing.

I'd appreciate a hint.

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

can anyone help me in c, i get correct submission (using binary search ) 258901211 but get 5 wrong submission by using the end value 1e12,1e14,1e15,1e18 . can anyone say the reason why only 1e13 get accepted

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

cool contest! how to solve E please?

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

Can we binary search on C div 2?

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

in div.2 D2 number of pairs(n, m) {n fixed, m unbounded} is equal to this OEIS A063647 but couldnt proceed further. did someone solve it by looking at this oeis?

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

How to solve B2? The max I could reduce the problem to is that any pair $$$(a, b)$$$ must satisfy $$$((a / g) + (b / g))$$$ divides $$$g$$$ where $$$g = gcd(a, b)$$$, but I still have no clue how to actually count this faster than $$$O(n \sqrt{n} \log{n})$$$.

Also B2 >>> C in my opinion, it took me ~15-20 mins to come up with the overall approach for C while I was unable to get anywhere on B2 after 1.5hrs of thinking T_T.

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

    It should be reduced to count pair $$$(a, b)$$$ such that $$$(a+b) | b^2$$$

    You just need to prove that if $$$(a + b) | b^2$$$ then $$$(a+b) | gcd(a,b) b$$$

    It's actually enough to iterate over all factors of $$$b^2$$$ that no more than $$$b+n$$$

  • »
    »
    2 года назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +1 Проголосовать: не нравится

    Let $$$a=gx, b=gy$$$ where $$$gcd(x,y)=1, g=gcd(a,b)$$$. $$$(x+y)$$$ divides $$$gy$$$, let $$$gy=q(x+y)$$$ or $$$qx=y(g-q)$$$, $$$y$$$ divides $$$qx \implies y$$$ divides $$$q$$$. Let $$$q=py$$$. So $$$gy=pyx+py^2 \implies g=p(x+y) \implies p$$$ divides $$$g$$$. Also note that $$$x \lt n/g$$$ and $$$y \lt m/g$$$. This allows you to check all pairs $$$(x,y)$$$ such that $$$gcd(x,y)=1$$$ and $$$x+y = g/p$$$ by iterating through all values of $$$p,g$$$. Overall time complexity is $$$\sum_{p=1}^{min(m,n)} \sum_{g=rp, 1 \lt =r \lt =min(m,n)/p} \ min(m,n)/(rp) = \sum_{p=1}^{min(m,n)} min(m,n)/p = O(min(m,n)log(min(m,n)))$$$

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

    Here is how I solved B2

    Assume that $$$gcd(a,b)=g$$$ and let $$$a=gx$$$,$$$b=gy$$$ and $$$gcd(x,y)=1$$$. Since we need $$$g(x+y)$$$ to divide $$$g^2y$$$, we get that $$$(x+y)$$$ divides $$$gy$$$. So let $$$A=x+y$$$ and $$$B=y$$$. Here are few observations

    1. $$$A \gt B$$$

    2. $$$gcd(A,B)=1$$$

    3. $$$A$$$ divides $$$g$$$ giving $$$A\leq g$$$

    4. $$$gB \leq m$$$

    5. $$$g(A-B) \leq n$$$.

    Thus we get that $$$B\leq\sqrt{m}$$$ and $$$A\leq \sqrt{m}+\sqrt{n}$$$. So we can brute force on each $$$(A,B)$$$ pair which satisfies $$$1$$$ and $$$2$$$ and find the value of $$$g$$$ that ensures $$$3$$$,$$$4$$$ and $$$5$$$ by say precomputing multiples of every number.

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

    Maybe it is an easier way:

    let $$$s=a+b$$$, then $$$(a+b)|b \cdot \gcd(a,b)$$$ equals to $$$s| b \cdot \gcd(b,s-b)$$$, equals to $$$s | b \cdot \gcd(b,s)$$$.

    It meens that, for each prime $$$p$$$, let $$$p^{k_1}|b$$$ and let $$$p^{k_2}|s$$$, then $$$k_1 \ge k_2/2$$$.

    Calculate all prime factors of all integers, for each $$$s$$$, calculate the number of $$$b$$$.

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

I do really enjoyed this contest. Unfortunately, couldn't derive the formula for Div.2 D2 that would work with O($$$nlogn$$$) complexity

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

Out of curiosity, is there an easier approach than matrix expo to calculate the cumulative sums in Div1C?

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

    I solved it purely by observing the matrix. Took me a lot of time but managed to solve it using just prefix sums.

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

    It is actually a tree with depth less than $$$\log n$$$.

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

      Yes, but how do you count the number of times a node at depth $$$d$$$ is added to the current node?

      The recursive prefix sum value seems to be a linear equation of $$$d$$$ levels. I just gave up and used matrix expo to calculate the values in $$$O(\log^3(n) \cdot \log(k))$$$ time (the base matrix is just the lower triangular matrix, i.e, 1s for $$$col \leq row$$$).

      Then I just used these values along with the tree to calculate the answer.

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

        Simply write down on paper and notice that it is Pascal triangle.

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

        I strongly recommend you learn Generating Function! It is extremely useful!

        In this problem, let's write down a[1] a[2] a[4] a[8] as b[0] b[1] b[2] b[3] and see what happens if you do the reverse of $$$f$$$ in the problem statement. b will become b[0], b[1]-b[0], b[2]-b[1], b[3]-b[2]. And if we write down this array in the form of a generating function, it will be a transformation from $$$p=b_0 + b_1x + b_2x^2 + b_3x^3$$$ to $$$q=b_0 + (b_1-b_0)x + (b_2-b_1)x^2 + (b_3-b_2)x^3$$$, which turns out to be $$$q=p(1-x)$$$. If you do it for $$$k$$$ times, it will be $$$q=p(1-x)^k$$$. The coefficient of $$$(1-x)^k$$$ is simple.

        As you can see, generating function provides a clear and simple deduction towards the solution. Usually it is problem-agnostic, which means you can put anything involving counting (especially dynamic programming) into a generating function, and use math tools to solve it. You don't have to stare at the coefficients anymore. I got this solution using generating function withint 5 minutes.

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

    Yes, the $$$i$$$-th value is actually $$$\binom{k+i}{i}$$$. If you turn your head, you should try see a pascal triangle

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

Div2F is nice, implemented binary search part but couldn't to find minimum >= previous on x jumps in time.

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

I'm too bad at maths for this.. was so close to IM but now I'm back to low master cause I got hardstuck on NT lmao

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

:( :( :(

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

Mathforces.

Weak pretests. Maybe I can get positive delta with points earned by hacking.

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

can someone give me the submission of div2 C i checked my code at least 1000 times i couldn't find a mistake.

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

How to solve D1 div 2?

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

    First, you have to see that a must be a multiple of b. Then, it is a pretty straightforward (n+m)*log(n+m) implementation, where you iterate over all possible b and over all multiples of b.

  • »
    »
    2 года назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +2 Проголосовать: не нравится

    $$$a + b$$$ must clearly be a multiple of $$$b$$$. This is only satisfied when $$$a$$$ is a multiple of $$$b$$$.

    However if $$$a$$$ is a multiple of $$$b$$$, then $$$gcd(a, b) = b$$$, meaning $$$a + b$$$ must actually be a multiple of $$$b ^ 2$$$.

    So we have $$$a + b = k * b ^ 2$$$, or $$$a = k * b^2 - b$$$. So for each $$$b$$$, you can just count the number of multiples $$$k$$$ which generate valid values of $$$a$$$ in a total of $$$O(m \log m)$$$ or $$$O(m)$$$ time depending on implementation.

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

    We are counting values of (a+b) which are multiples of b.gcd(a,b).

    e.g. (a+b) = k.b.gcd(a,b) (for some k values)

    dividing through b gives a/b + 1 = k.gcd(a,b)

    This means that a is divisible by b, e.g. let a = Xb, then gcd(Xb, b) = b

    Which reduces the problem to

    a+b is divible by b^2

    Iterate all b's, and look for how many b^2 fit beneath "maximum value of a" + the current b and sum them all up.

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

    You need to know two things for this.

    1) are you aware of "sieve of eratosthenes" ? What is the concept behind it ? What will be runtime complexity of it ?

    2) Reduce the formula



    => (a + b) % (b * gcd(a,b)) = 0, => (a + b) = k*(b * gcd(a , b) ) where 'k', is some random positive integer ( because => Right side is divisible by 'b' . So, left side also must be divisible by 'b'. => Left side, among (a + b) , 'b' is already divisible by 'b' ( obvious ) , so 'a' also must be divisible by 'b'. 1. Based on above, we know that 'a' is multiple of 'b'. Use two for loops, using sieve concept. complexity will be apprx O( n log n log n ) , considering modulo and division and multiplication occur in O(1).
    • »
      »
      »
      2 года назад, скрыть # ^ |
       
      Проголосовать: нравится +3 Проголосовать: не нравится

      Why do you need SoE or something like that if ones just use the following piece of code?

      int count(int n, int m)
      {
          int k = 0;
          for (int b = 1; b <= m; ++b)
              k += (n / b + 1) / b;
      
          return k - 1;
      }
      
      
      • »
        »
        »
        »
        2 года назад, скрыть # ^ |
         
        Проголосовать: нравится +2 Проголосовать: не нравится

        Same problem can be solved in multiple ways. my approach and your approach are different.

        My solution is based on what I did during the contest, I never claimed, that it is most optimised approach xD.

        I reducing the formula, I reached an observation, that 'a' must be multiple of 'b'.

        Now, for all 'b', within 1 to m, I will traverse through all possible multiples of 'b'.


        for(int i = 2 ; i <= m ; i++) { for(int j = i ; j <= n ; j += n) { f ((i+j) % i . gcd(i,j) == 0) ans++;

        To understand the time complexity I gave an example of SoE.Hope I have explained how I solved the problem.

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

mathforces

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

Am I the only one using Mobius Inversion to solve Div.1 B2? I spent almost an hour and couldn't find simpler solution. Also C<<B2

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

    Yeah being stuck in D2 made me lost rk1(Div 2). I spent almost an hour in it :(

    Actually when you found that $$$x+y | g (xg=a, yg=b, g=(a,b))$$$, you will realize that $$$(x+y)g \le n+m$$$ and $$$x+y \le g$$$ which means that $$$x+y \le \sqrt{n+m}$$$, so you can brute force every possible (x,y) and solve the number of g in about $$$O(n+m)$$$.

    BTW how to solve by Mobius Inversion I dont know lol

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

These are some good problems 💪💪🔥🔥

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

https://mirror.codeforces.com/contest/1972/submission/258921511

Can anyone pls tell what is wrong in this code for C?

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

B2 is restarted

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

My pre-contest predictions:

  • Math
  • Data structure
  • Implementation

Seems that all my predictions are correct!!

"Thanks" for such a round to let Chinese Rounds become stereotyped!!!

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

How to solve D2 (div. 2)? I've figured that x * y / (x + y) = n means (x — n)(y — n) = n ^ 2 and was trying to iterate through n, looking at all its divisors, getting divisors of n ^ 2 from it and trying to form all valid (x, y) pairs from it. But since n can get pretty large, O(max N * sqrt(max N)) takes too long.

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

    $$$a+b | b\cdot (a,b) \rightarrow g(x+y) | g^2y\space \space(let g = (a,b) ,x = a/g , y = b/g) \rightarrow (x+y)|gy \rightarrow (x+y)|g \space \space((x+y,y)=(x,y)=1)$$$

    When you found that $$$x+y | g (xg=a, yg=b, g=(a,b))$$$, you will realize that $$$(x+y)g \le n+m$$$ and $$$x+y \le g$$$ which means that $$$x+y \le \sqrt{n+m}$$$, so you can brute force every possible (x,y) and solve the number of g.

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

Thanks for this contest, I really liked problem $$$C$$$!

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

If you submit the code casually, you even have a good chance of passing problem B and D1.

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

A question to anyone who solved div1C: does $$$\mathcal O(n\log^2 n)$$$ solution with the restoration of the value from indexes with a lower lowbit value to indexes with bigger lowbit values work?

UPD: the question is no longer relevant.

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

hello

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

Does my solution Can be hacked ? 258885731

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

Thank rui_er for giving a so easy CN Round.

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

Div. 2 B and C were literal guessforces. I spent an hour trying to find a solution to B, even wrote a brute force, then I viewed the samples and be like "Hmmmm... It's almost as if the U count is odd then Alice wins else Bob". And pretests passed... Whatever. Probably I'm just too retarded and it's actually very easy to prove.

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

how have so many people in Div2 solved D2?

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

what is the optimal rearrangement of the the 6th test in Div2 C test samples ?

I tried a lot during the contest to figure out what is the best rearrangement but I couldn't find it :(

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

I hope there will be a plagiarism check for this Round, since apparently the solutions to Div 2 A, B, C and D1 were leaked hardly an hour into the contest.

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

I can't call myself a mathematician anymore :(

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

Thanks for Interesting problem and positive delta~~

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

Anyone knowing in how much time aproximative the ratings will be out??

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

Why A is failing on systest?

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

Auto comment: topic has been updated by rui_er (previous revision, new revision, compare).

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

CNOI Round 🤓👎

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

In div2 on D2 we have 588 accepted solutions. In div1 on B2(same task) we have 582 accepted solutions.

funny :)

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

why D1 is so easy may be some other problem can be placed at D and D2 can be a different problem

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

There seemed to be a weak pretest in C? 4000AC->3600? And I seemed to fly about 100 rank:)

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

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

day by day div 2 is getting harder for me :)

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

I have made detailed video explanations for C and D1 Question Here are the links for anyone who wishes to watch

C : https://www.youtube.com/watch?v=ZP4HPYTWtZQ D1 : https://www.youtube.com/watch?v=cSKooXv7FKA

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

Finally a div.1 standing with tourist rk1 and jiangly rk2! BTW, congrats to Kevin!

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

amazing problems! However math problems are a little more than I expected,which I'm not good at.

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

Why more and more gcds?They are not interesting!!!!!!!!!

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

please provide an update on when the rating will be updated?

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

I found myself waking up six times throughout the night, hoping to see my new 'Max Rating,' yet it remains unchanged even now!

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

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

Is it rated?

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

Is there any issue/delay in updating rating of this round?

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

Did anyone try to prove the solution div2 B? I think we get the pattern pretty quickly, but proving it is not intuitive. How do we prove that with induction?

  • »
    »
    2 года назад, скрыть # ^ |
    Rev. 3  
    Проголосовать: нравится +5 Проголосовать: не нравится

    At every turn, the parity of the total number of 'U' cards flips. This is because once we flip a 'U' card, the number of 'U' cards decreases by 1. Now since it has two neighbours , it will be either a). DD -> UU b). UU -> DD c). UD -> DU

    Either the number of U increases by 2, decreases by 2 or remains same. Since we already discarded a U card, the parity always flips. Also since the maximum number of U can be the current size of the string, we can guarantee the game will end at most after n turns. The winner of the game is the person who gets the string with only 1 U left. So we can conclude that whoever starts with odd number of U's will be the one who will get to the state where there is 1 U left, and hence will win the game.

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

Was this contest unrated?

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

Over a day and wasn't rate. Why??

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

And finally, it's rated!

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

tourist is back on top againnn

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

nazmulaas2023 is my second id....on this contest..by mistake of mine i submitted my code into nazmulaas2023...that's why my code of nazmulnns2066 and nazmulaas2023 is same...unitentionally i did this...please consider..i apologise for this mistake

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

i made a mistake during the contest..i submitted C in my wrong id which is nazmulaas2023..when i realize this...i change some of the code and then submitted in my id nazmulnns2066 which i did the contest..that's my code look similar.. i apologise for my mistake..

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

sorry MikeMirzayanov, but the system declare that my 1972C submission is similar to huanjua. My explaination is we are both students come from Ho Chi Minh City and in 2015-2016 entrance exam in VNU.HCM for grade 9 there is a problem using the same binary search idea and we use the same idea. Please give me back my rating. Thanks