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

Автор MateoCV, история, 5 лет назад, По-английски

Hola Codeforces!

I am happy to invite you to Codeforces Round 774 (Div. 2), which will take place on Mar/04/2022 18:35 (Moscow time). Notice the unusual time! The round will be rated for participants with rating lower than 2100. You will have 2 hours to solve 6 problems. The problems were authored and prepared by me.

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

See you in the standings!

UPD:

Scoring distribution: $$$750$$$ — $$$1000$$$ — $$$1250$$$ — $$$2000$$$ — $$$2500$$$ — $$$3000$$$

Thanks to competitive__programmer, video editorials for some of the problems will be available on his channel after the round.

UPD: Editorial

UPD: Congratulations to the winners!

Official winners:

  1. lydia1
  2. mjhmjh1104
  3. Turret
  4. Vsinger_MoQingxian
  5. WAduck
  6. woolim
  7. Iam1789
  8. yagoo
  9. Koba.rde
  10. dtc03012

Unofficial winners:

  1. Vercingetorix
  2. Um_nik
  3. hank55663
  4. mzen
  5. dlalswp25
  6. disorientation
  7. rainboy
  • Проголосовать: нравится
  • +643
  • Проголосовать: не нравится

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

Good luck and high rating.

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

Good luck to all Ukrainian contestants

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

Note The Unusual Timings (1 Hour Late)

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

gl ^ hf

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

best of luck for all♥️

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

Good luck and positive rating!!!

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

This will probably be my first contest in over a month...I'm awaiting -100 delta :P

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

Good luck everyone. Maybe this round will help improve people's mood at codeforces.

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

    hello gagan plz guide me as i am stuck in newbie-pupil phase from a long long time and i don't see improvement also provide tips for dp if any. thnx in advance.

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

      The key to improvement is indeed just good-old practice. Now, everyone should choose a practice regime which suits them well. I just like you were shuffling pupil and newbie for 1 year. This year I started practicing more with a focus on solving questions rather than learning new algorithms. You only need a handful of algorithms like dfs-bfs, Dijkstra, dsu, segment tree to reach the expert but dp practice is very important. I practiced dp from problemset with filter-tag and started solving from 1000 rated questions and gradually increased rated questions. When I felt like I can do 1600 rated dp questions pretty confidently then I started randomly doing questions with gradually increasing difficulty from 1000 to 1600.
      Make sure you actually solve the questions and don't see the editorial until you solve it. If it seems impossible then try to read other people's code before checking out editorials. Do cp with your friends, discuss approaches and try to outrank your peers :p. This is what has worked for me till now, hope this helps you. Good luck!

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

Maybe we have the opportunity to just focus on this round itself!

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

Look at the quality of the questions. My hands are too slow.Orz

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

Before the usual time was 16:35, then 15:35, then 11:35 ... What is the actual usual time ?

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

ooo thanks

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

Are we going to fight against "Robot" in this round?

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

May C problem be solved by less than 2000 people. I want it to be an interesting one.

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

First argentinian contest! Congratulations MateoCV

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

Contest after long time.Eager to participate

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

Good luck everyone! Have a good contest!

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

Argentinian round? Aguante el Diego, Talleres y FaMaF!

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

Good luck!

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

Unfriendly time for Chinese contestants.

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

Dear contest, How do you feel today? Yet another person commented on your announcement page rn (me). Since I said hi to you, please give +ve this time to me. yk the usual. thanks in adv

Regards, that random user asking for +ve in rating

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

Very cool scoring distribution 1000 — 750 = 1250 — 1000 , 3000 — 2500 = 2500 — 2000

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

there is no as a tester comment.

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

SpeeeeedForcesssss

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

antonforces

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

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

I haven't coded recursive code in 2 years lol good to remember it with problem C

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

It took me 2WA's and 50 minutes to figure out that for long long integers __builtin_popcount doesn't work and we need to use __builtin_popcountll ... :-/

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

5th test case of problem D...

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

it was so fun to write 15 nested for loop in problem C(p.s. I know recursive solution would also work)

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

Imagine wasting 20 mins debugging E because you "simplified" $$$\frac{lcm(x_1, x_2, \ldots, x_k)}{x_1}$$$ to $$$lcm(x_2, \ldots, x_k)$$$ without thinking properly T_T.

Also I can't exactly describe it, but CDE feel like they are somehow standard yet fairly interesting at the same time. Maybe its because they have extremely simple and natural formulations which don't feel like they've been forced to match an idea?

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

A nice contest for me!! I loved the problem C. Would love to share my experience while solving problem C,

Initially after reading the problem , I immediately thought of solving it using subset generation through bitmasks , because i thought the size of factors + powers of 2 would be around 30 , but turned out it was ~52. So i drifted a bit & thought of solving it using DP(using coin change approach) but that is also not feasible.

Solution :

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

Logic for C?

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

    Note that n can allways be constructed with number of its bits, since these are powers of 2.

    So construct all possible sums of factorials (that are at most 2^14 since there are only 14 factorials in range), subtract each one from n and count the bits of the difference.

    Smallest number of set bits in difference plus bits in factorial sum is ans.

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

How to do F?

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

What d hell is test case 5 of D -_-

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

My Idea for D :

  • Take all leaves to be good vertices
  • Now all parents of the leaves (call it buds) are assigned with weight = 1
  • Now the graph is split into separated sections with "buds" as boundaries for each section
  • For each section, I solve them independently by coloring it "bipartitely". In each section, I find which gave me the best arrangement whether the color "black" / "white" on this section are good vertexes and bad vertices for its counter-color.

I got WA on pretest 6. Not sure if the idea is wrong or my implementation My submission : 148381092 Any thoughts?

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

    I tried the same thing (but failed pretest 5) :(

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

    it is true that a good vertex(blue) must be surrounded by bad vertices(black) but it is not necessary that bad vertices be adjacent to good vertices. so if u two color the tree, u wouldn't take into consideration cases where two adjacent nodes are bad

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

    Pretty sure it's finding the max independent set.

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

    How does the problem change after removing all the leaves?

    If there exists some tree for which bipartite doesn't work, I can just create a new tree by attaching a single node to each leaf and your soln won't work for it.

    And try the following graph if you don't get why bipartite is incorrect:

    Input Graph
    Answer
    A Correct Solution
»
5 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Could someone share their approach for B ?

I tried solving it by sorting the array (minimize the Blue sum) and using prefix sum, but failed. I think this is because my approach colored all the numbers.

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

    Use sum of two smallest numbers as small sum, and biggest number as big sum.

    If both sums are ok ans=YES else add next smallest number to small sum, next biggest number to big sum. Repeat.

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

    Well, I also sorted it first, and then kept on calculating Blue Sum from the start and Red Sum from the end of the array. Also, to maintain the count(Blue) > count(Red), I initialised the starting index to be 1(0-based indexing) while initialising Blue Sum to be equal to the first array element.

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

submitted C in the last minute

took more than 1 hour to realize brute-forcing all subsets of factorial values is feasible

but brute-forcing all subsets of 2-power values is infeasible which gave me a wrong intuition that the factorial counterpart is also infeasible

I hope in the future I can be more familiar with the thresholds of feasibility.

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

Thanks for the contest, I don't know why I did so dumb on A and B, But after all I really liked the problems.

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

In c, finding all the numbers powerful in a set then take a number which are just less than n and subtracting them from n is not feasible why?

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

what is pretest 6 of D? ಥ_ಥ

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

I think D is just Maximum Independent set with least total degree which can be solved by dp. I realised this, but could not reconstruct the solution from the dp before the contest ended.

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

How to solve E? I was looking for numbers with the same prime factors

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

    Take 2, 4, 8, ... as example. In the row starting with 2, you get 2^1, 2^2, ... In the row starting with 4, you get 2^2, 2^4, ..., so what in the cells are these powers of 2: 1 ~ M, 2 * 1 ~ 2 * M, 3 * 1 ~ 3 * M, ..., depending on how many powers of 2 are less than or equal to N. Then, what you need to do is calculate how many distinct number is in this list. Sum up all the length of lists of a number that is not power of another one. Don't forget 1.

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

Any counterexample on D solving with 2-coloring?

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

Hey,
In the first problem, why this works cout << s/(n*n) << '\n';
but using cout << (int)(s/pow(n,2)) << '\n'; gives wrong answer in test 2?

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

tried dp in D but it doesn't work... so retried bipartite and failed again.

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

Is it possible to output -1 in c ??

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

Getting MLE on test 39 on problem D just because I used longs and a relatively high memory constant is the most unfair thing ever...

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

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

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

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

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

Nice contest!

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

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

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

Would this idea work for D?

idea