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

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

Hello Codeforces!

I am happy to invite you to Codeforces Round 783 (Div. 2), and Codeforces Round 783 (Div. 1) which will be held on, Apr/19/2022 17:35 (Moscow time)! This round is rated for both divisions.

I would like to thank the following people who made the round possible:

In each division there will be 6 problems and 2 hours to solve them.

Score distribution:

Div. 2: 500 — 500 — 750 — 1500 — 2000 — 2500.

Div. 1: 250— 1000 — 1500 — 2000 — 2750 — 3500.

Good luck!

UPD: Editorial

UPD2: Congratulations to the contest winners:

Div. 2:

  1. HenHenHenAAAAAAAAAAAAA

  2. QiangBro_ShuDe

  3. MarioPariona117

  4. Moomer

  5. SpadeA261

Div. 1:

  1. OddImage

  2. tourist

  3. maroonrk

  4. Um_nik

  5. heuristica

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

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

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

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

As a tester, good luck and have fun!

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

Am I the only person who is surprised from low points in score distribution?

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

As a tester, good luck and have fun! Problems are interesting and well prepared.

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

GoodLuck everyone!!

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

Maybe it will be like that: A(500), B1(500), B2(750)

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

Why does it take place on Tuesday?????

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

WaaaaaaaH....... Div-2 score distribution..... Hopefully contest will be interesting... <3

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

Judging from the score distribution, it seems like a speedforces round for div 2. Hoping for +ve delta for everyone.

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

As not a tester, good luck and have fun!

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

.

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

I will participate in this contest with my favorite electronic cigarettes.

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

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

ocean of downvotes >_<

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

downvotesforces

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

Anybody here who can help me to change my username in codeforces id ??

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

People who are downvoting for no reason, may their girlfriend and wife cheat on them

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

thanks to ones for making this round possible

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

I'm afraid that people would be happier with 1000-1000-1500-3000-4000-5000 scoring in div2

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

Am I the only one who can't focus on solving the fourth problem just because there are too less successful submission.

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

Codeforces Round #783 (Div. 2) in one photo:

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

Div.1 C is weird. I dislike it very much.

It's not that I failed to solve it, but such problem should appear in MO instead of competitive programming.

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

How to solve Div2 D?

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

What was the segment tree idea in D? I was thinking for any element e in the prefix sum array, we need to find the rightmost element in the suffix that is greater than prefix[e-1] in log n, but I couldn't figure out how to encode this into a data structure.

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

It is discouraging to see C was leaked like half an hour ago before the contest ended on same youtube channel that leaked answers during the last contest. It has around 350 views.

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

How to do Div.2 C? I did an $$$O(n^2)$$$ way and it was too slow.

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

    maybe you should consider what index should be "0", near the index should be "1", and ans+=a[i]/a[i+1]+1

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

    Check for each i (put that i 0 then form a decreasing sequence in the first half and an increasing sequence in the second half).

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

    My $$$O(n^2)$$$ was accepted. For each element, suppose the final value for $$$b_i$$$ is $$$k_ia_i$$$ for $$$k_i$$$ which is integer (and could be negative). Then you want

    $$$k_1a_1 \lt k_2 a_2 \lt ... \lt k_n a_n$$$

    Since $a_i\geq 1$, we bruteforce over the last index $$$i$$$ where $$$k_i$$$ is non positive. Set $$$k_i=0$$$. Then greedily assign $$$k_1, ..., k_{i-1}$$$ so $$$k_{i-1}a_{i-1} \lt k_ia_i$$$, $$$k_{i-2}a_{i-2} \lt k_{i-1}a_{i-1}$$$. Same thing for $$$k_{i+}, ..., k_n$$$. The choice of $$$i$$$ with the minimum $$$\sum_j k_j$$$ is the solution.

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

    the solution is in the testcases explanation, just find number of operations required when a[i] is kept 0, try for every index and output the minimum

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

    Okay, apparently, I did the same thing. For each $$$i$$$, I set $$$b_i = 0$$$, then I went through to the left and the right finding out the no. of operations to make the left decreasing and right increasing. Then, I output the minimum no. of operations. But then this $$$O(n^2)$$$ didn't work. I am using Python 3 btw. Is that why?

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

For problem $$$D$$$, I tried having a DP of $$$dp[i]=\max_{j \lt i} { dp[j] + sgn(PS[i]-PS[j])*(i-j) }$$$ where $$$PS$$$ is presum table and $$$sgn$$$ is the sign function. I was wondering if we can use a DP speedup (convex hull) on it, but couldn't prove monotonocity. Can I get any hints if this is an ok approach/what I am missing?

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

    Hint: use segment tree to speed up computation of your dp (maybe more than one).

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

For Division 2 The problems rating is not appropriate. First and second problem should have rating of 1000.

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

Guys i am confused https://codeforces.me/contest/1668/submission/154129473

above submission is passing pretest but

https://codeforces.me/contest/1668/submission/154104345

this doesn't. Although both are exactly same except that gans in first one is initialised to LLMAX. does answer in any test case exceed LONG_MAX? I wasted one hour on this :(

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

It's been a long time since I've received so many negative emotions from the C div 1 solution....

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

TAT

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

Feedback on the problem set:

  • A: Very good problem. I had seen something similar recently and this was immediate.
  • B: Standard problem, still enjoyable. I thought a bit in order to find a way to avoid a segment tree, but couldn't find any way. In the end, coded a segment tree.
  • C: Spent quite some time trying to prove a lower bound (without success), then I found a reasonable construction and guessed that it was correct (hinted by the number of ACs). The statement and the solution are nice, but I don't really like to encounter this kind of problems in a competitive programming competition.
  • D: Not read (skipped since the ranking suggested that E could be a better choice).
  • E: Okayish problem. It is rather easy for being an E. After few minutes I had the main idea, then I spent a lot of time getting indexes right (it was a miracle that I managed to submit it before the end of the contest).
  • F: Not read.

Thanks to the authors for the contest!

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

    Proving the lower bound in C is actually very easy.

    Let $$$k$$$ be the minimum value such that there are $$$k$$$ columns and rows without a queen. Then $$$n - k \leq Q$$$, where $$$Q$$$ is the number of queens you place.

    Since there are $$$k$$$ columns and $$$k$$$ rows without a queen, there are $$$k^2$$$ squares you need to cover with diagonals. These squares appear on at least $$$2k - 1$$$ distinct diagonals. Thus, we must have $$$2k - 1 \leq Q$$$ where $$$Q$$$ is the number of queens you place. Thus, $$$\max(2k - 1, n - k) \leq Q$$$, thus $$$\left\lceil \frac{2n - 1}{3} \right\rceil \leq Q$$$.

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

    For B, the segment tree can be avoided by maintaining two monotonic sets (one for positive-sum, the other one for negative-sum) and a map(when the sum is 0). Ugly code :/

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

    It is quite surprising to me that one might solve C in the way that does not immediately prove its correctness, hence I believe criticism on this aspect is unjustified. Here is how my line of thoughts looked like: https://codeforces.me/blog/entry/102013#comment-904940

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

      You are right when you say that once one finds the construction, then the proof is straight forward.

      I am not criticizing the problem because one can guess the solution. I don't like it because it contains zero computer science.

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

Let me try it: AtCoderForces

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

any hints for b and c ??

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

And thanks to the authors for the exercise on DP with Segment tree

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

I hate this round.

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

    In every contest there will be someone who hates contest and may call it "Insert_a_topic_here" + forces . Instead we should focus on our skills and appreciate the efforts of problemsetters.

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

The comment is hidden because of too negative feedback, click here to view it

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

Don't look at ranks 160-200

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

enjoyed a lot solving CDE, solved only C, but anyway, great problems, thanks

(but B was a non-sense and stupid, such problem just SHOULDN'T be in div1)

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

is greedy + segTrees possible for D?

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

  image-2022-04-19-T16-22-07-267-Z

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

Places 160 — 200 of div2 have the same code for ABCD.

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

Some feedback:

I really liked ACD!

During the contest, I liked B, because I used the observation that there are no segments of size at least $$$2$$$ with sum $$$\le 0$$$, but as it can be solved entirely without this observation (with more segment trees), it's not a very good problem :(.

Also, E is pretty standard, but it's okay.

Anyways, thanks for the contest, I enjoyed it!

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

This is my solution for problem C

https://codeforces.me/contest/1668/submission/154109773

what's wrong?

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

Got a question about time constraints for PyPy 3. In Div.2C after coming up with O(N^2) solution I was reluctant to submit it for quite a while, because 25mil operations seemed like a certain TLE. What would you say is an appropriate op/s limit for PyPy here? Or are there some time adjustments and n=5000 should be an instant hint that O(n^2) is fine anyway?

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

Can someone tell me the test case fails for this code 154119937

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

i request the setters and testers to find out the same codes and penalise them

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

can anyone explain test case 2 of problem C of Div2? Shouldn't the answer be 8?

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

Can somebody help me find out why my solution get TLE in pypy3, but accepted in pypy3-64 with only 514ms? 154083919

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

    I guess it's because division is an expensive operation and 64 bit pypy3 was able to handle the large number divisions better than the 32 bit version. This is what I thought before submitting my solution again after 2 TLE verdicts, but honestly I was surprised that it actually passed the pretests!

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

    Same here, and what a shame that I only realized the pypy3-64 existence in the last 10 minutes of the contests

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

I think it was on of the better recent rounds. I think that all problems were quite good and I have no significant points of criticism. Thanks for preparing it!

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

I unnecessarily wasted time in B thinking that they'll sit in order. I know that it was there in the explanation for a sample test case, but still could have mentioned that in the problem statement Peti chod.

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

SmallscoreForces

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

Nice round, thank you!

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

sus!!!?? His/her previous solutions got skipped and this contest's solutions also look sus! MikeMirzayanov

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

Ratings updated preliminarily. We will remove cheaters and update the ratings again soon!

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

I think there are a lot of cheaters(aside from the videos that get uploaded on youtube during contest). And who is downvoting normal comments?(like 50+ downvotes for a lot of comms). Please ban their ip's because they can always make a new account)

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

Cheaters in div2 160-200 places. I checked about 10 accounts, all of these registered five days ago, all have the same code

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

here comes the cheaters on page 2 HtePhANA_ affianced.leon claudette_thomas_00

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

peti1234 for div2 problem B, my solution get an AC.

solution

but It should be wrong based on this test case:

1
1 4
3