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

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

Hello, Codeforces!

We are pleased to announce the resumption of the Global Rounds. Thanks to XTX Markets for supporting the initiative! In 2024, we will hold 4 such rounds. The series results will take into account the best 3 participations out of 4.

On Oct/27/2024 17:35 (Moscow time) we will host Codeforces Global Round 27.

Codeforces Global Round 27 marks the third round in the 2024 series of Codeforces Global Rounds. These rounds are open and rated for everyone.

The prizes for this round are as follows:

  • The top 30 participants will receive a t-shirt.
  • 20 t-shirts will be randomly distributed among participants ranked between 31 and 500, inclusive.

The prizes for the 4-round series in 2024:

  • In each round, the top-100 participants get points according to the table.
  • A participant's final score will be the sum of the points they earned in their 3 highest-placing rounds.
  • The top 20 participants across the series will receive sweatshirts and placement certificates.

We extend our gratitude to XTX Markets for supporting the global rounds initiative in 2024!

The 8 problems were authored by our 8 authors: Benq, lunchbox, oursaco, sum, willy108, Hori, turtletortles, and last but not least ChatGPT.

We would also like to thank:

Round Information:

  • Duration: 180 minutes
  • Number of problems: 8 problems with 1 subtask
  • Score distribution: 250 — 500 — 1000 — 1500 — 2000 — 2250 — (2250 — 2000) — 4500

We look forward to your participation!

UPD: Congrats to the winners

  1. Kevin114514
  2. 275307894a
  3. jiangly
  4. JoesSR
  5. ksun48
  6. turmax
  7. dXqwq
  8. hos.lyric
  9. heuristica
  10. jiangbowen

UPD2: First solves

A: dXqwq
B: hos.lyric
C: dorijanlendvaj
D: riantkb
E: turmax
F: taeyeon_ss
G1: taeyeon_ss
G2: Kevin114514
H: orz (only in contest solve!)

UPD3: Editorial

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

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

As a setter, I was unable to get a picture of myself eating [] before this blog was posted.

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

As a tester, I am glad willy108 was unable to eat [] before this blog was posted.

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

As a tester, love the contest, love the problems!

and orz willy108

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

As a setter, I can confirm this contest is one of the contests of all time.

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

orz

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

I love newbies just as much as I love ChatGPT

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

    im a newbie, could u plz help me getting z best benefit of this "codeforces" , i am really confused with it ..

    i have some questions i just need u to awenser it for me :) 1- where and how to find problems to solve Gradually? 2- when i will be ready to enroll one of these contests that is published on here? 3- how much time should i spend here a day? thanks in advance :)

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

      First of all you are not a newbie :)

      1. problemset is right there. Start from 800 rated problems. (b/w I also use USACO and Cses problemset)
      2. you came to cf you are eligible.
      3. hmm.. i never counted probs or no of hrs. we are just starting here so need to spend some good amount of time.
»
23 месяца назад, скрыть # |
 
Проголосовать: нравится +45 Проголосовать: не нравится

TAKE THIS ROUND

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

As a tester who has not tested yet, the problems are very good and you should take the contest!

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

Hope to see tourist register for this contest.

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

orz

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

keys is gonna cook

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

Orz

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

Chatgpt authored a problem!??

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

non-negative votes for comments, blog.

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

Benq round orz

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

Funny time is comiing

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

How can ChatGPT be an Author? :). How can I make questions using ChatGPT?

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

as a tester...

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

As a tester, I want to orz willy108 for also playing Arknights.

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

Would unrated registration will ever be available on div.1s? It seems like this is the 4-th div.1 that could have unrated registration enabled.

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

qp

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

Hoping to become purple after this contest!

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

lesgo

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

wanna see tourist vs jiangly today

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

Hoping to see jiangly reach tourist!

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

Hope to reach expert today!

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

Excited to see jiangly reaching 4000 & the new name for 4000<=.

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

tourist has registered for this contest. His rating is gonna change today. I hope he will cross $$$4100$$$

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

As a tester, I really hope yall enjoy this round!

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

Best wishes

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

it is rated or unrated ??

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

So, ChatGPT is expert?

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

I was sweating while solving C

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

Was this rated?

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

OK..Stuck on D forever with WA on pretest 2.

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

Guessforces

Nice D have to study about it

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

I'm really not a fan of B, I honestly don't think I would have solved this problem in a "no internet" contest because who remembers the divisibility properties for 11...

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

god D made me so pissed, I was only getting the last number from the last test wrong i changed all the MODS, reviewed all of them and still wrong

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

rip in piece i got unlucky on D (first try AC but i way overcomplicated it)

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

I feel so dumb, Forever stuck on D, Need to improve on my debugging and analysing skills

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

Can you please tell us which one chatGPT made?

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

Too weak for C again... GG

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

How to solve D?

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

ObservationForces

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

Most of the CM / Experts(including me) tried a lot to pass (bruteforce + ternarySearch) to pass pretests for problem E.

E has some sort of

This pattern for 3rd test case

There are multiple local minimums. How to find the optimal local minimum ?

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

how to solve C?

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

nice problem D need 2 more minutes to submit :(

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

In problem D, "Since this problem is too easy" killed me.

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

If there's no elegant solution for B and C then they are not good, since it's casework for odd\even basically. D and E on the other hand are great, thank you.

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

i hate overflow :(

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

For C, I just got the pattern for $$$n \gt 4$$$. if $$$n$$$ is odd, a permutation of $$$[2, 1, 3, 4, 5, \dots, n]$$$ always gives the max answer which is $$$n$$$. For even the maximum answer will be $$$2^{p+1}-1$$$, where $$$p$$$ is just the number of the leftmost bit, and it's still the same pattern but $$$2^p-1$$$ should be the last number. but if $$$n$$$ is a power of $$$2$$$ it should be the last number after the $$$2^p-1$$$. I want proof of this.

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

I solved C by guessing but got stuck on both D and E. I enjoyed the contest though, D is a great problem in my opinion. I think I was missing the case where it was a situation like [4, 4, 11, 2, 3], and the max array would be [1, 1, 176, 1, 6], not [1, 1, 176, 2, 3].

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

Can anyone Share Idea of problem C ?

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

Why I found D easier than C :(

IDK why it was happening while doing C my brain not Braining I was not able to focus on the pattern.

Damnnn any ideas ?

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

    How to solve D?

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

      i did dp till index i such that total power of 2s <= 32 and then do greedy aferwards
      can't submit during contest, but let see if that's correct or (hopefully) atleast the idea is correct.

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

    For large enough ($$$\geq 8$$$ works) even $$$n$$$, you can just end the permutation with $$${1, 3, maxpow-2, maxpow-1, n}$$$, where $$$maxpow$$$ is the greatest power of $$$2$$$ that's $$$\leq n$$$, which ends up with having all bits that are set in at least one number $$$\leq n$$$ on, so the answer is $$$2*maxpow-1$$$. A greater answer is clearly impossible. And for large enough odd $$$n$$$ ($$$\geq 8$$$ still works), you may note that the result is bounded by the last element of the permutation, and therefore by $$$n$$$. And the result $$$n$$$ is achievable by putting $$$n$$$ at the end of the optimal permutation for $$$n-1$$$. Cases where $$$n \lt 8$$$ can be hardcoded.

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

I am not able to solve the problems after the contest. I am getting "You can't run practice now or contest does not support practice" error.

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

Editorial?

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

During this contest my mental health dropped to a new record.

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

hints for F?

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

Why are global rounds always so hard :sob:

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

Weak systests on E, incorrect "sqrt" decomp (~2e7 ops/tc worst case) passes in 500ms:

https://codeforces.me/contest/2035/hacks/1094322 (uphack of my own sol)

Didn't think to pick my parameter correctly. Didn't matter.

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

I like the essential observation part of problem G, nice! However reading a binary search using closed interval ($$$[l, h]$$$ instead of $$$[l, h)$$$) was painful, please go learn X(

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

Pressed submit and timer ended 1 second before. Tried submitting after system testing. It was AC. :(

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

Why is the amount of wrong submissions for E more than $$$11$$$ times the amount of correct submissions, what was going on

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

bruh, the round was sweaty to be fair. Anyway ,returned ,my expert after a disasterous div2 yestersay.

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

Loved the contest, thank you! G is cool, F is nice, D is nice, E is OK, and B&C are also OK.

Missed the trivial "remove every test" case in G1 :(

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

hope to have rate soon

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

My final code was edit distance 2 away from AC-ing E...:(

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

Hint to D:

Let us pick $$$a_i$$$ and $$$a_j$$$ and decompose $$$a_i$$$ into $$$a_i=p_i\cdot2^{q_i}$$$ where $$$p_i$$$ is odd and $$$q_i \gt 0$$$. Performing the operation on $$$a_i$$$ and $$$a_j$$$ is optimal if and only if $$$p_i \lt a_j$$$.

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

Liked C a lot:

  1. Solve for evens through solve for odds, always a cool trick. I used $$$solve(2n) = [\ldots, solve(2^{\lfloor\log(2n)\rfloor} - 1), 2n]$$$.
  2. A lot of ways to solve for odds: I used $$$[\ldots, 3, 1, n - 1, n]$$$ as $$$(n & (n - 1)) = n - 1$$$ for odd numbers and $$$1 & 3 = 1$$$ that we can push to the ans as well.
  3. $$$n \ge 5$$$ is a good constraint. I hadn't to manually if cases.

Maybe a bit harder than a regular D2C, but definitely solvable (and in many approaches, whats not always a case). It's generally hard to create a good problem for position C and today it was just awesome.

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

For problem D, I didn't understand how to use the modulo. When I apply it to intermediate results, it gives me the wrong answer. If I only use it at the end, I get a TLE. I believe the numbers are getting too large. Any help?

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

    In my correct submission, I apply it while calculating answer for each index but I store numbers num = x * 2^y as (x, y) , where x is an odd number (Edit: clearly here x and y will always lie in int range as per constraints in the problem). And while comparing I use log2 of the num which is log2(x) + y, which gives correct comparison.

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

      Thank you for the explanation. but, still I didn't get why applying the modulo for every intermediate result cause a wrong answer!

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

        I don't exactly know in which steps you are applying mod, but if you apply mod and then some comparisons on some value on which mod is already applied then you should expect wrong results.

        Or else, maybe your solution which gives TLE is also wrong, just that it gives tle before detecting wrong answer in the test cases (maybe). Is there any test case which passes the TLE solution but gives wrong answer verdict on your other solution.

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

    Numbers quite large. So, instead of doing the multiplication, you just need to store the oddNumber, and powerOfTwo everytime you process the value. This will help in managing integer overflows ( although, in python u won't get any ).

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

In problem D of this round, it has missing test cases. One missing test case that I found, which potentially could give rejected verdict on some submission:

1
3
999999986 2097152 1048576

My last submission 288365525 during contest gives correct answer for it, but my earlier submission during contest gives wrong answer. But still when I resubmitted my earlier submission 288377619 after the contest ended to check if it passes system tests, unfortunately it passed!!

Explanation of mistake in earlier submission:

My approach for above given test case:
given n = 3, and array a = {999999986 2097152 1048576} = {499999993 * 2^1, 1 * 2^21, 1 * 2^20}

for i = 1: f[a1] = a1 (obviously)

for i = 2: f[a1, a2] I first check if I can transfer power of 2 from earlier indices which have power of 2 and increase the total sum.
I check it as if last_element_having_factor_2/(power_of_2_in_it) <= current_element, then transfer the power.
Since, transferring power from a1 to a2, will reduce the total sum, so I don't do it here.
So, f[a1, a2] = (999999986 + 2097152)%1000000007;

for i = 3: f[a1, a2, a3]
last previous index which has power of 2 is a2 which is 1 * 2^21 and since 1 <= current_a3 (1 * 2^20), so I transfer the power from a2 to a3, then a3 becomes 1 * 2^41.
then last element which has power of 2 is a1 which is 499999993 * 2^1 and here is where there is silly mistake in my older submission which still passes the system test cases.
In my correct solution I check if log2(499999993) <= log2(1) + 41 , but in older submission I checked if 499999993 <= 1 * (2^41 % 1000000007), which gives wrong answer as it does satisfy the condition to transfer the power, but it should.
So, correct answer = (499999993 + 1 + 2^42)%1000000007 .
But my other submission (which passes the system tests) gives answer = (999999986 + 1 + 2^41)%1000000007 .

This modular arithmetic mistake could have been done by few (or maybe many) other users also. So Hori, would the test cases be updated and since many others might have done same mistake, would the solutions for problem D be rejudged for the contest or the updated test cases be used for further submissions only. Or test cases won't get updated as contest is over.

Edit: My flawed submission has been uphacked. I didn't know someone can uphack even after contest ends and hacking phase ends.

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

I don't think D is a good question about mod.

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

orz

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

Too many cheaters again today on D, submission blew up too much in the last one hour

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

    I think, D was little difficult to implement. That's why people took time to fully implement it. Even, so many Red coders submitted D in the last 1 hour of the contest. Does that mean, Red coders also cheated !

    Your assumption might be true in other cases, but IMO, today's D was actually time-consuming to implement.

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

can anyone tell me what is i am doing wrong in my code for 4th question code---

~~~~~~~~~~~~~ #include

include

include

include

using namespace std;

int main() { long long T; cin >> T; while (T--) { long long n; cin >> n; vector nums(n); vector ans; // Store the answer for each test case priority_queue store; long long sum = 0;

for (long long i = 0; i < n; i++) {
        cin >> nums[i];
        long long power = 0;
        long long TS = 0;
        vector<long long> temp;
        vector<long long> newVec;

        // Move elements from the priority queue to temp and calculate TS
        while (!store.empty()) {
            long long Temp = store.top();
            temp.push_back(Temp);
            TS += Temp;
            store.pop();

            // Count the power of 2
            while (Temp % 2 == 0) {
                power++;
                Temp /= 2;
            }
            newVec.push_back(Temp);
        }

        // Calculate adjusted value with safety check
        long long adjustedValue = nums[i];
        if (power > 0) { // Only apply shift if power is positive
            // Check for overflow before shifting
            if (adjustedValue > numeric_limits<long long>::max() >> power) {
                adjustedValue = numeric_limits<long long>::max(); // Cap to max long long
            } else {
                adjustedValue <<= power; // Use left shift for power of 2
            }
        }

        if (TS != 0 && adjustedValue > TS) {
            // Update sum carefully
            for (long long val : temp) {
                sum -= val; // Remove old values from sum
            }
            for (long long val : newVec) {
                sum += val; // Add the new values
            }
            sum += adjustedValue;

            if (adjustedValue % 2 == 0) {
                store.push(adjustedValue);
            }
        } else {
            for (long long val : temp) {
                store.push(val); // Push back the old values
            }
            sum += nums[i]; // Directly add current number
            if (nums[i] % 2 == 0) {
                store.push(nums[i]);
            }
        }

        ans.push_back(sum);
    }

    for (long long value : ans) {
        cout << value << " ";
    }
    cout << endl;
}

return 0;

}// ~~~~~~~~~~~~~~~~~~

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

why noone mentions the anime Alya Sometimes Hides Her Feelings in Russian for problem C LOL