By ArshiaDadras, 21 month(s) ago, In English

👋 Salam, Codeforces!

We are thrilled to invite you to the Rayan Programming Contest 2024 - Selection (Codeforces Round 989, Div. 1 + Div. 2).

The Selection Round is a rated contest for Div. 1 + Div. 2, taking place on 30.11.2024 17:35 (Московское время). The problems for this round were crafted and prepared by ArshiaDadras, MohammadParsaElahimanesh, AmShZ, AmirrzwM, and Keshi.

The top 60 trusted participants (with a maximum of three from each country) will qualify for the onsite Final Round in Tehran, in Spring 2025. An additional quota is reserved for the host country. Hotel accommodation, local transportation, and meals will be provided to all finalists. More details about the final contest will be available on the Rayan website.

🏆 Selection Round Prizes:

  • The top 50 participants will receive T-shirts. 👕
  • Additionally, 50 random participants from ranks 51-1000 will also receive T-shirts.

🏅 Final Round Prizes:

  • 1st place: $15,000 💵
  • 2nd place: $10,000 💵
  • 3rd place: $5,000 💵
  • 4th–6th places: $2,000 each
  • 7th–10th places: $1,000 each

🙏 Special Thanks:

We would like to extend our deepest gratitude to:

📊 Score distribution: $$$500 - 750 - 1500 - 1500 - 2000 - (2000 + 2000) - (3000 + 3000) - 5000$$$

We look forward to seeing you both online and onsite!

Good Luck & Have Fun! 🎉

📝 Note: Editorial just published here! 🚀🍿


🔔 Update: The official announcement for the Rayan 2025 World Finals has just been published! 🎉 You can read all the details about the onsite event in Tehran, November 25–29, 2025, in Arpa’s blog. For registration, schedule, and more information, please visit the Rayan website. Make sure to check it out if you’re among the top 1000 in the Selection Round! 🚀

  • Vote: I like it
  • +546
  • Vote: I do not like it

| Write comment?
»
21 month(s) ago, hide # |
 
Vote: I like it +17 Vote: I do not like it

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

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Is there a separate category for Iranians, or will all participants be grouped together?

    • »
      »
      »
      21 month(s) ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      All participants are considered together. The only difference is that we have a separate quota (about 30–40) for Iranians, which will not be counted within the main quota.

»
21 month(s) ago, hide # |
Rev. 2  
Vote: I like it +43 Vote: I do not like it

As a tester, I didn't know I could have won $15,000 (just needed to beat a certain Belarusian...)

Y'all should give it a shot!!! Good luck.

»
21 month(s) ago, hide # |
Rev. 2  
Vote: I like it +21 Vote: I do not like it

As an author, please give me T-shirt too.

»
21 month(s) ago, hide # |
Rev. 2  
Vote: I like it -114 Vote: I do not like it

I predict tourist will fall below 4000.

Edit after round: everyone who downvoted this should apologize to me in DMs.

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Nice! This must be one of the rounds of all time, I'm so excited to see my teachers' round ;)

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it +13 Vote: I do not like it

    Let me tell u sth about ArshiaDadras:

    I officially started competitive programming and programming classes with Arshia Dadras four years ago. He is a very capable and ethical teacher. Thank you, Arshia, for being so great <3

    • »
      »
      »
      21 month(s) ago, hide # ^ |
       
      Vote: I like it +15 Vote: I do not like it

      Thank you so much for your kind words and support, AmirParsa!

      It’s truly a pleasure to be remembered in such a thoughtful way. I’m also really happy to see that you’re continuing to improve your coding skills.

      Wishing you the best of luck in your journey, and I hope we get to meet in person soon!

      • »
        »
        »
        »
        21 month(s) ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        Thank you, man. It's an honor for me to have grown under the guidance of professors like you. I'm looking forward to meet you in person too ;)

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

"The top 60 trusted participants (with a maximum of three from each country)"

How will you enforce this?

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it +14 Vote: I do not like it

    We will start inviting participants from the top of the list while considering the country limit (a maximum of three participants per country) until we fill all 60 spots. Each invited participant will have a specific time frame to confirm their attendance. If someone declines or cannot attend, their spot will be given to the next eligible participant from the scoreboard who meets the criteria.

»
21 month(s) ago, hide # |
 
Vote: I like it +24 Vote: I do not like it

As a tester, this is the $$$4^{th}$$$ time in a row I found at least one problem in the round I tested really satisfying, and I hope people would feel the same.

»
21 month(s) ago, hide # |
 
Vote: I like it +34 Vote: I do not like it

I love Persian contests!

»
21 month(s) ago, hide # |
 
Vote: I like it +14 Vote: I do not like it

As a tester I wish good luck to everyone!

»
21 month(s) ago, hide # |
 
Vote: I like it +35 Vote: I do not like it

As a tester, I can confirm that I tested this round.

»
21 month(s) ago, hide # |
 
Vote: I like it +20 Vote: I do not like it

As a tester, I liked to test my first round! :)

PS: If you win $15,000, please give me the T-Shirt, hahaha

»
21 month(s) ago, hide # |
 
Vote: I like it -19 Vote: I do not like it

Final Round Prizes: 1st place: $15,000 2nd place: $10,000 3rd place: $5,000 4th–6th places: $2,000 each 7th–10th places: $1,000 each

^^^

How much will you win? They're really rich...

(This is my first comment on CodeForces so if you think I'm wrong please politely scold me)

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    If you look at their website, the onsite part is sponsored by a university and from what I can tell an entire ministry, and these prizes are for the onsite part. This round is only a selection round before the onsite one.

»
21 month(s) ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

as a persian, i can confirm i ain't winning shit

»
21 month(s) ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

W salam

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I'm quite interested that, is there any special about the sponsor? why does this contest appears on the top bar?

»
21 month(s) ago, hide # |
 
Vote: I like it +37 Vote: I do not like it

tourist will destroy this contest to earn money

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

As a participant, I will participate!

BTW, what watch are you wearing, sir ?! ArshiaDadras

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Do you arrange this every year?

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it +13 Vote: I do not like it

    We’re planning to do that, but this is Rayan’s first year!

    We need to evaluate the feedback and reception from participants before making a clearer decision.

    • »
      »
      »
      21 month(s) ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Thanks.. It will be great. Can I ask you the meaning of "Rayan"

      • »
        »
        »
        »
        21 month(s) ago, hide # ^ |
         
        Vote: I like it +33 Vote: I do not like it

        “Rayan” is derived from the first part of the Persian word “Rayaneh,” which means “computer.”

        Fun fact: If someone asks us, “What is the event name?” we would reply, “It’s Rayan.” In Persian, we could say this as “Rayan eh,” which follows the same pattern as saying, “It’s cold” -> “Sard eh” or “It’s good” -> “Khoob eh.” Interestingly, this sounds exactly like the word “Rayaneh”!

»
21 month(s) ago, hide # |
 
Vote: I like it -14 Vote: I do not like it

this round will make tourist get back to gm i guess. lol

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I'm just looking at the rewards knowing I won't be even close to top 10 :/

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it +3 Vote: I do not like it

    Why not? At the very least, you’d get to enjoy a wonderful trip to Iran, stay in one of the best hotels here for free, and experience some amazing hospitality! (if you can make it to the top 60 😁)

»
21 month(s) ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

if there are $$$50$$$ russians above me and all of them refuse to go to the onsite, will i be invited?

»
21 month(s) ago, hide # |
 
Vote: I like it +14 Vote: I do not like it

As an Iranian, this really makes me proud!

  • »
    »
    21 month(s) ago, hide # ^ |
    Rev. 3  
    Vote: I like it +14 Vote: I do not like it

    And I would like to thank the medalists who designed the questions and all the people involved and hardworking in this event!

    I think it is a good thing that the famous programmers of Codeforces come to our country.

    I hope to see the tourist here!

»
21 month(s) ago, hide # |
 
Vote: I like it +41 Vote: I do not like it

The same day as chinese NOIP! Hoping we all have good performance in the both round!

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Is this round rated?? as normal cf contest

participation is enough for registration or i have to register on website or something??

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    It's like a normal rated contest in CF. Also, participation is enough for registration and you don't need to register on the website or somewhere else.

»
21 month(s) ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

Time Conflict with ICPC Regionals QAQ

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Salaam too.

»
21 month(s) ago, hide # |
 
Vote: I like it +14 Vote: I do not like it

As a tester, I wish everyone good luck! :)

»
21 month(s) ago, hide # |
 
Vote: I like it -16 Vote: I do not like it

teams or no?

»
21 month(s) ago, hide # |
 
Vote: I like it +22 Vote: I do not like it

Rayan Gosling Round

»
21 month(s) ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Wish tourist back 4000++ once more.. yo yo

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

rainboy orz (Problem H).

»
21 month(s) ago, hide # |
Rev. 2  
Vote: I like it +42 Vote: I do not like it

Seems orzdevinwang will become tourist soon!
...Why does the sentence sounds that strange.

»
21 month(s) ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

I said D > C;

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

What is the case in E where a solution exists for both k and n being odd and k < n?

»
21 month(s) ago, hide # |
 
Vote: I like it +17 Vote: I do not like it

C was so annoying to solve. Forgot one edge case and spent all my contest time on it, leaving no time for D :(

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    Actually, C seemed difficult to me not because of solving the problem, but because of the implementation. What edge case did you get stuck on? I can share my solution if you want.

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How to solve E?

  • »
    »
    21 month(s) ago, hide # ^ |
    Rev. 2  
    Vote: I like it +21 Vote: I do not like it
    Spoiler
»
21 month(s) ago, hide # |
 
Vote: I like it -68 Vote: I do not like it

Sooo nice E! Though it contains some casework, there is a beautiful construction method.

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Can you share it with us common folk?

    • »
      »
      »
      21 month(s) ago, hide # ^ |
       
      Vote: I like it +9 Vote: I do not like it

      We treat $$$n=1$$$, $$$k=1$$$, $$$k=n!$$$, $$$k \gt n!$$$ first.
      Let's define $$$i$$$ th permutation as the permutation when we call next_permutation for $$$(1,2,\dots,n)$$$, $$$i-1$$$ times.
      First we construct for even $$$k$$$. We can just take $$$i$$$ th permutation $$$p$$$ and $$$(n!)+1-i$$$ th permutation $$$q$$$ together. (actually, $$$p_i = n+1-q_i$$$)
      For even $$$n$$$, if $$$k$$$ is odd, the answer is No (because $$$k \times \frac{(n+1)n}{2}$$$ isn't divisible by $$$n$$$)
      Now, we construct, for odd $$$n$$$, $$$k=3$$$. This can be done by this method (as an example, let $$$n=7$$$).

      • $$$(1,2,3,4,5,6,7)$$$
      • $$$(4,5,6,7,1,2,3)$$$ (left shift $$$\frac{n-1}{2}$$$ times)
      • $$$(7,5,3,1,6,4,2)$$$ (make sum = $$$3 \times \frac{n+1}{2}$$$)

      At last, we construct, for general odd $$$k$$$. We ignore following pairs:

      • $$$(1,2,3,4,5,6,7)$$$ and $$$(7,6,5,4,3,2,1)$$$
      • $$$(4,5,6,7,1,2,3)$$$ and $$$(4,3,2,1,7,6,5)$$$
      • $$$(7,5,3,1,6,4,2)$$$ and $$$(1,3,5,7,2,4,6)$$$

      At the current state, we can take $$$\frac{n!}{2} - 3$$$ pairs. After that, just add $$$k=3$$$. Then, we can construct for $$$3 \le k \le n!-3$$$.

      • »
        »
        »
        »
        21 month(s) ago, hide # ^ |
         
        Vote: I like it +3 Vote: I do not like it

        tysm

      • »
        »
        »
        »
        21 month(s) ago, hide # ^ |
         
        Vote: I like it +1 Vote: I do not like it

        wow! That left shift (n-1)/2 is insane, Any inspiration to come up with that?

        • »
          »
          »
          »
          »
          21 month(s) ago, hide # ^ |
           
          Vote: I like it +54 Vote: I do not like it

          I saw this problem and immediately coded brute force for $$$n=5$$$ and $$$k=3$$$ and the first one that came out was that construction

        • »
          »
          »
          »
          »
          21 month(s) ago, hide # ^ |
           
          Vote: I like it 0 Vote: I do not like it

          It comes by try & error so I can't tell exact step, but I tried to match $$$(1,4,7)$$$ first, suddenly cames up my construction.

          Maybe $$$(1,2,3,4,5,6,7)$$$ + (shift) leads the difference of the sum of two permutation $$$+2, +2, \dots, +2, -n+2, +2, \dots, +2$$$ (and under odd $$$n$$$, this works) is the decent way?

        • »
          »
          »
          »
          »
          21 month(s) ago, hide # ^ |
          Rev. 3  
          Vote: I like it 0 Vote: I do not like it

          I didn't manage to solve E during contest (I was really close, but I missed a few simple cases, like n = 1 and forgot about the cap for evens). I did get something very close. But basically once you realise that you can do all evens up to n! you can come up easily with "maybe if I can figure out a solution for 3 then it will work". And then you realise that you are looking for something that once you add 1 2 3 ... n it makes the same thing, you get the idea that you make something where the sum increases by 1 every time. I still had some trouble, but then I thought it would be easier if I just do every 2.

          So for every 2 I could do for 7:

          4 5 6 7

          1 2 3 4

          that would add up to 5 7 9 11

          and then the rest complete the sequence. So my own solution for 7 was:

          4 1 5 2 6 3 7

          1 5 2 6 3 7 4

          7 6 5 4 3 2 1

          Then it's somewhat obvious that 4 = 7 / 2 + 1. Then it was easily expandable as start for n / 2 + 1 for the first one.

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it +8 Vote: I do not like it

    why is this getting downvoted

    • »
      »
      »
      21 month(s) ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Because the problem E is neither nice, nor beautiful.

      • »
        »
        »
        »
        21 month(s) ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        how you rate a problem can be subjective, however, why would you take it out onto someone else who's not involved in setting it?

»
21 month(s) ago, hide # |
Rev. 2  
Vote: I like it +20 Vote: I do not like it

Nothing could be worse than losing rating on my birthday :(

Edit: problems are nice, I choked on H with some cases like 1 3 105 63 45 and what I missed is just enumerating the GCD of all picked numbers...

»
21 month(s) ago, hide # |
 
Vote: I like it +92 Vote: I do not like it

AT 2:53 OF CONTEST TIME THE DIFFERENCE BETWEEN TOURIST AND ORZDEVINWANG WAS 32 POINTS. TOURIST NEEDED TO HACK SOMEONE AND HE MANAGED TO DO SO 8 SECONDS BEFORE THE END OF THE CONTEST!!!!!! BUT ORZDEVINWANG SOLVED G2 3 MINUTES BEFORE THE END OF THE CONTEST, SECURING THE FIRST PLACE!!!!! WHAT A DRAMA OMGOMGOMGOMGOMGOMGOMGOMGOMGOMGOMGOGMOG

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

The problems were nice, though I feel like I solved something very similar to F a long time ago on Codeforces (I didn't have time to solve it though, I spent too long on implementing D and E). Also, they have very nice pictures :D Do you think that they are AI generated? They are very intricate but I don't see any obvious AI artifacts. Otherwise, big respect to the artist who made them.

»
21 month(s) ago, hide # |
 
Vote: I like it +21 Vote: I do not like it

orz orzdevinwang. Also IF orzdevinwang didn't solve G2, then tourist would have won by doing a successful hacking attempt at the last minute, that's crazy.

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Is it true that in H the max size of the answer is 3? And does it have randomized solution?

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it +18 Vote: I do not like it

    The max size of the answer is 6. let $$$x=2\cdot3\cdot5\cdot7\cdot11\cdot13$$$, then $$${\frac{x}{2},\frac{x}{3},\frac{x}{5},\frac{x}{7},\frac{x}{11},\frac{x}{13}}$$$ is a valid set

  • »
    »
    21 month(s) ago, hide # ^ |
    Rev. 4  
    Vote: I like it +14 Vote: I do not like it

    Here is the rough sketch for H.

    This is how we can characterize all possible linearly independent sets $$$a$$$.

    First find a set of distinct primes $$$p_1,p_2,\ldots,p_k$$$ and let the gcd of all the $$$a$$$ be $$$g$$$. We will write $$$P = \prod p_i$$$ as the product of all the primes here.

    Then we can construct a linearly independent set $$$a_1,a_2,\ldots,a_k$$$ where $$$a_i$$$ is a multiple of $$$\frac{gP}{p_i}$$$ but not $$$gP$$$.

    For each linearly independent set, you can find a corresponding $$$(g,p_1,p_2,\ldots,p_k)$$$ that satisfy the above constraint.

    Then after brute forcing everything, you realize the the number of possible $$$(g,p_1,p_2,\ldots,p_k)$$$ with $$$k \geq 3$$$, $$$g \mid P$$$ and $$$\frac{gP}{\min(p_i)} \leq 10^5$$$ is at most 500k or something. So you brute force everything. I had to use a bunch of constant opts to pass because my code is shit.

    Checking answer is at least $$$2$$$ can be done in $$$O(n \log n)$$$.

»
21 month(s) ago, hide # |
 
Vote: I like it +31 Vote: I do not like it

What's with the constraint of A? I see a lot of people passed it with brute forcing, but they're quite close to the time limit, while I got TLE and I suspect it's because I used long long instead of int.

I don't see why it couldn't be much higher so that no brute force solution could pass, or be much lower so that every brute force solution could pass.

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Why are there few pretests on problem D and E? I'm worried that my solution won't pass the system tests.

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How to solve F? I cant find any clear approach to solve this problem

  • »
    »
    21 month(s) ago, hide # ^ |
    Rev. 3  
    Vote: I like it +11 Vote: I do not like it

    Firstly, for simplicity, redefine the special conditions to be in terms of the number of rubies/sapphires in your satchel (not chest). Then add dummy states $$$(0, 0)$$$ and $$$(n, m)$$$ for convenience (we won't double value at these though).

    Define dp states to be $$$dp[i]$$$, which is the total sum of value of your satchel across all ways you can reach the state defined by the $$$i$$$-th condition.

    To solve this dp you will firstly need to define some ordering on the conditions so that when evaluating some dp state, all the states that it depends on have already been evaluated. Just sort by $$$x + y$$$.

    Then, the transition from state $$$i$$$ to state $$$j$$$ will correspond to the ways you can go from state $$$i$$$ to state $$$j$$$ without visiting any other special condition state in between.

    Computing the number of ways you can go from state $$$i$$$ to state $$$j$$$ (where $$$i$$$ occurs before $$$j$$$ in the topological ordering) without visiting any intermediate special condition state is easy and can be done using inclusion exclusion in $$$O(n^3)$$$. Call this $$$w[i][j]$$$.

    Also define the total number of ways for us to go from state $$$i$$$ to $$$j$$$ to be $$$g[i][j]$$$. This can be computed in $$$O(1)$$$ using simple combinatorics.

    Define the addition in value for going from state $$$i$$$ to state $$$j$$$ without any intermediate doubling to be some $$$h[i][j]$$$.

    Then, the dp formulation for state $$$i$$$ is:

    $$$dp_i = 2 \cdot \sum{dp_j * w[j][i] + g[0][j] * w[j][i] * h[j][i]}$$$

    (where $j$ occurs before $$$i$$$ in the topological sort)

    All states will be evaluated in $$$O(n^2)$$$.

    The final answer is the value of the dp state corresponding to the the state $$$(n, m)$$$ divided by the total number of ways to go from $$$(0, 0)$$$ to $$$(n, m)$$$, which is just $$$\binom{n + m}{n}$$$.

»
21 month(s) ago, hide # |
 
Vote: I like it +6 Vote: I do not like it
meme on C
»
21 month(s) ago, hide # |
 
Vote: I like it +68 Vote: I do not like it

I liked F. However E is bad.

(1) I believe it made the contest unfair that one sample testcase was silently added. What you should have done is to make a clarification as an annoucement instead.

(2) The essential part had appeared multiple times — IMO 2009 Shortlist C2 and UTPC2023 and possibly many others. The "distinct" part does not add fun (perhaps personal opinion).

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

who can tell me why runtime error pleaseYour text to link here...

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

294071265 this gives runtime error on pretest 8 for problem C . Can anyone tell what is the reason . I have not seen similar verdicts in any other solutions , so I am curious what caused this error ?

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    have you considered what would happen if dfs(i, j) went out of bounds?

    • »
      »
      »
      21 month(s) ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      How can this even happen , for all border elements which are overflowing i have assigned visited =1 and verdict=-1 initially only. Can you explain or give example

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How to solve D ?

  • »
    »
    21 month(s) ago, hide # ^ |
    Rev. 3  
    Vote: I like it +1 Vote: I do not like it

    What I did was iterate until the columns are sorted. On each iteration I:

    1. Swap the 1 that is furthest to the left with the 0 that it furthest to the right until all 0s are to the left of every 1.

    2. Swap the 2 that is furthest to the left with the 1 that is furthest to the right until all 1s are to the left of every 2.

    I did have to use a set to store the indexes otherwise it would TLE.

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I can't imagine how many people were blocked by $$$n=m=1$$$ in $$$C$$$ and $$$n=k=1$$$ in $$$E$$$...

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    why is n=m=1 in C an edge case? I didn't consider this and it seems fine

    • »
      »
      »
      21 month(s) ago, hide # ^ |
       
      Vote: I like it +6 Vote: I do not like it

      if you have all ?-s in the grid, then n=m=1 is the only case you will have 0 as answer. otherwise the answer is n*m always.

      but still depends on the implementation obviously, i failed it though

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    Wrong answer on test 4 ...

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it +3 Vote: I do not like it

    I realized right after the end of the contest is that the wrong with my code for $$$E$$$ is that I didn't handle the case where $$$n = 1$$$

    it really hurts 😢

»
21 month(s) ago, hide # |
 
Vote: I like it +16 Vote: I do not like it

A regular request to increase the memory limit to allow solutions in python. Going from https://codeforces.me/contest/2034/submission/294035798 to https://codeforces.me/contest/2034/submission/294041682

was neither insightful nor fun.

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

BRO I passed A with 999ms whats on about the tight TL

»
21 month(s) ago, hide # |
Rev. 2  
Vote: I like it -10 Vote: I do not like it

GreedyForces

»
21 month(s) ago, hide # |
 
Vote: I like it +37 Vote: I do not like it

idk how many CF rounds I have to do to stop wasting half an hour on finding N = K = 1 testcases on E and similar :v

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    If you have a hard time figuring that out, then what am I supposed to do? I missed two test cases in E....

    • »
      »
      »
      21 month(s) ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      & I used "int n" instead of "long long n" and couldn't debug it though i had 1 hours left. :) sadlyf.

»
21 month(s) ago, hide # |
Rev. 2  
Vote: I like it +26 Vote: I do not like it

I FST-ed on A :( Why half allow O(t*a*b) solution

»
21 month(s) ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

loved the statements, especially the characters. look forward to seeing this competition continue in the coming years!

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

TLE on A system testing because of define int long long

»
21 month(s) ago, hide # |
 
Vote: I like it -19 Vote: I do not like it

Loved the images :)

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I still do not understand why I got TLE on A and B in the system testing while the other similar answers were getting accepted...

A: https://codeforces.me/contest/2034/submission/294007119 B: https://codeforces.me/contest/2034/submission/294033976

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

https://codeforces.me/contest/2034/submission/294091655

please someone help me in figuring out whats wrong in my code?

please!

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hoping to get my first t-shirt(among Randomly choosen 50 participants)

»
21 month(s) ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

This is my code for question A but it has not been accepted and showing TLE . How is this possible. I have reviewed my code thoroughly and believe it is correct .The code should definitely work as the constraints are — (1≤a,b≤1000) and (1≤t≤100). Many with same logic have their solutions accepted. I kindly request re-evaluation of my submission.

Submission Id — 294008048

#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "Debugtemplate/template.hpp"
#else
#define debug(...)
#define debugArr(...)
#endif
#define int long long
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define mp make_pair
#define F first 
#define unmp unordered_map<int,int>
#define S second 
#define all(x) x.begin(),x.end()
#define sortasc(x) sort(all(x))
#define sortdes(x) sort(x.rbegin(),x.rend())
#define f(i,ind,n) for(int i=ind;i<n;i++)
#define PI 3.1415926535897932384626
const int mod = 1000000007;

void solve(){
    int a,b;
    cin >> a >> b;
    for(int i=min(a,b);i<=a*b;i++){
        if(i>=a || i>=b){
            if(i%a==i%b){
                cout << i << endl;
                return;
            }
        }
    }
}
#undef int
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
// freopen('input.txt','r',stdin);
// freopen('output.txt','w',stdout);
    int t;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Your solution works in $$$O(tab)$$$, with the constraint the worst case is $$$10^3\times 10^3\times 10^2=10^8$$$.

    However, the % operator has a large constant factor, which might case TLE in this case.

    #define int long long also slow down your code a little bit.

    PS: your code runs for about 2700ms on AtCoder (usually faster than codeforces) in about a $$$8\times 10^7$$$ total product, which is within the constraint. It would definitely TLE in the worst case here.

»
21 month(s) ago, hide # |
 
Vote: I like it +27 Vote: I do not like it

The fact that the glorious history of Iran and amazing myths were mentioned in the text of the questions made me proud that I was born in Iran. I hope this beautiful work will be repeated later.

»
21 month(s) ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

unable to view the editorial

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

hello everyone do you know how to get job because i was recently graduated i don't know what to do

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

can anybody give me the id of this contest

»
21 month(s) ago, hide # |
 
Vote: I like it +9 Vote: I do not like it
»
21 month(s) ago, hide # |
 
Vote: I like it +18 Vote: I do not like it

Nice problems! F2 and H are nice, even though I wasn't able to debug the latter in contest time :(

On a side note: Why insert the image in the middle? It randomly divides the statement into two parts, which can be really annoying when checking to see if you have missed something.

»
21 month(s) ago, hide # |
Rev. 3  
Vote: I like it 0 Vote: I do not like it

Today I received this message:

Spoiler

This is unfair decision. The only similar parts of this submissions: mine, studboy — is parts with sets, which is not the main logical part. Main ideas looks quite similar, but ways of solving are different. Hope this misunderstanding will be fixed.

  • »
    »
    21 month(s) ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Hello, Timophey!

    Detecting similarities between codes and marking them as potential cheating cases is not something handled by the problem authors. In fact, we aren’t informed when these checks are performed or who ends up being flagged as a result.

    This process is part of the system’s automated operations. I believe reaching out to KAN or contacting the appropriate individuals in charge might help resolve this situation for you.

    I’m sorry that I’m unable to assist directly with this matter.

»
20 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

best problems

»
18 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I received a form to promote the final round from system, but my rank is 160 (about 20 of Japanese). Is this message correct?

  • »
    »
    18 months ago, hide # ^ |
     
    Vote: I like it +10 Vote: I do not like it

    Yeah, that's correct!

    You could be one of the qualified participants if those ahead of you in the queue decline to attend the in-person contest, making you the next candidate for an invitation.

    This form is sent to potential invitees rather than the final list of confirmed qualifiers. After you complete it, an official invitation letter will be sent separately.

    • »
      »
      »
      18 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      If I answer "yes", am I required to accept the formal invitation? How much will the trip cost?

      • »
        »
        »
        »
        18 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        The official invitation letter will provide more detailed information about the event, including trip costs, the exact date, and other relevant details. You will also have the opportunity to ask any questions you may have during this process.

        As far as I remember (not entirely sure), the only cost you need to cover is your flight tickets; we will cover everything else!

»
12 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Why does like have of the Codeforces population have an anime character as their PFP?

Sure, there's nothing wrong with that until you see it's all females/waifus.

Hey, I'm not judging(Just curious), but it can't just be that everyone just wants to have their PFP as a female/waifu.

And maybe it's just me but I have no idea who most of them are(including the male anime characters)