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

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

logo

Sugeng enjing, Codeforces! 🥰🥰🥰🥰

COMPFEST 15 is happy to invite you to participate in Codeforces Round 902 (Div. 1, based on COMPFEST 15 - Final Round) and Codeforces Round 902 (Div. 2, based on COMPFEST 15 - Final Round) on Oct/08/2023 12:05 (Moscow time). Both rounds will be rated. You will be given 2 hours and 30 minutes to solve 7 problems.

Note the unusual time of the round.

The problems are written by ArvinCiu, Pyqe, and nandonathaniel.

We would like to thank:

COMPFEST itself is an annual event hosted by Universitas Indonesia. It is the largest student-run IT event in Indonesia and competitive programming contest is one of the competitions hosted.

We hope you will enjoy and have fun in the contest. Muga-muga beja lan isa entuk biji apik!! 💪💪🔥🔥

UPD: Scoring distribution

  • Div. 1: 500 — 1000 — 1250 — 1750 — 2250 — 2750 — 3250
  • Div. 2: 500 — 1000 — 1500 — 2000 — 2500 — 2750 — 3000

UPD2: Contest is over!

Congratulations to our winners!

Congratulations for our first solvers:

Div. 1

We will try to post the editorials as soon as possible. Please stay tuned!

UPD3: Editorial

On behalf of the COMPFEST committees, we are glad that our Codeforces Round ran quite smoothly and we hope that you all enjoyed our problems. See you next year! 😍😍

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

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

Thank you errorgorn for carrying

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

rfpermen will win COMPFEST 15!

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

Thank you Pyqe for carrying

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

orz errorgorn coordination twice in a row

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

.

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

    The round is based.

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

As a tester, I am forbidden from commenting on the announcement post with any opinion.

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

What is the meaning of Muga-muga beja lan isa entuk biji apik!!

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

As a tester I can assure you the problems are very **********************************.

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

The starting time was really weird but i guess it will be held on sunday after all

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

Finally a new round after 8 days :)

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

Contest, finally.

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

Not Every Country in the whole world observe a holiday on Sunday. In my country, Friday and Saturday are the two off-days in the week. And Sunday often is the busiest day of our schedule as it is the beginning of a new weekend. IF YOU COULD HOLD THAT CONTEST ON SATURDAY IN SUCH AN UNUSUAL TIME, then no people in the world would have had any problem as Saturday is the intersection of two traits of holidays.(friday-saturday based holiday like my country and Saturday-Sunday based on the majority of the country).

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

Good luck everyone, Remember, you don't lose when you fail, you lose when you give up.

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

what will be the score distribution system?

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

Tomorrow I will fall 100 rating in CF first and then fall to blue in ARC.

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

Hope I have good luck.

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

Please note the unusual timing of the round

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

Muga-muga beja lan isa entuk biji apik!! Sound interesting, What's that mean?

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

Please announce the score distribution system.

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

As a participant I hope to get 1200+ rating or even better, Pupil ****

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

Why are there so many problems(like 7 problems) in recent Div1 contests? It's hard to adapt.

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

best wishes

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

clashing with icc world cup

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

Finally, Chinese Oiers don't need to hold up to 1:05 evening. :D

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

good luck to everyone

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

265 forces

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

The Scoring distribution is opposite in the announcement, swap div1 with div2.

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

It seems D1 = 500 1000 1250 1750 2250 2750 3250, does it correct?

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

Completed A-D in 40 minutes ,then nothing for 2 hrs. E>>>>>D.

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

How to solve D

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

Can anyone please help me understand the solution for DIV2 Problem D Thanks in advance :)

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

    It will be quite hard to explain. Wait for an editorial.

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

    If we select any index i to make it black we can replace arr[i] with the maximum value at any index j, such that i is a factor of j (because we would always be marking all such j green).

    Then we can sort the resulting array, and now for the maximum element to be Kth from this array, we have 2^(k-1)*arr[k] possibilities, we can just calculate this sum for all the elements from 1 to n in the sorted array and take the remainder which would give the ans.

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

    I'll explain my solution, maybe not most efficient. Basically, for each idx we go to the right with step idx to find the maximum value that this idx can lead to after coloring. It is similar to how we use of sieve of eratosthenes, although in our case we do it for every idx, not skipping already visited before. (Let's say idx == 2, we're going to check idxs 2, 4, 6, 8,... and store max value of them. For idx == 4 we're going to check 4, 8, 12,...)

    After that we create dictionary value -> amount of idxs (that lead to that value after coloring them with black)

    And starting with greates value to lowest, you have value: amount of idxs. Let's say v: k. And let's say amount of possible numbers to choose from is n (it's n in the beginning). Amount of subsequences which contain at least one of numbers from those k numbers is 2 ** n — 2 ** (n — k). (total — amount of subsequences that don't contain at least 1 of those numbers). You multiply it by value v and add it to result. Then you do n -= k, as we don't want to consider those anymore. MOD at the end

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

Duck problem F

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

WTF with D's nowadays

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

What a great Contest

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

I'm honestly really annoyed at this, can someone see what's wrong with my code because I've been trying to debug this for the last 20 minutes.

Submission

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

Is my solution correct for D1C?

For each of the directed subgraph, we need to find cycles and then there are 3 cases on some pair of adjacent nodes (pick both, pick first, pick second). For each case, apply dp and find the maximum count of nodes we can pick. Then backtrack to get all the picked nodes.

Also, is there any simpler solution than this?

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

    I couldn't debug within time, but my approach was:

    Consider the usual directed edges (i, A[i]).

    If in-deg of a vertex = 0, then it cannot be circled. And so it's out-child has to be circled. And if we know that if a vertex is circled, it cannot circle its out-child, so decrease in-degree of its out-child (and if its in-deg becomes 0, mark it as not-circled, and push into the process-queue).

    Keep repeating the above two points, until you end up with no vertex with in-deg = 0. So, in-deg of all 'active vertices' >= 1 and we already know that out-deg = 1 for all. So, in-deg = out-deg = 1 for all active vertices. So it's just a bunch of cycles. Iff all cycles are even, there's a soln.

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

How to solve D1C?

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

    given graph is cycles with tentacles

    first — delete tentacles:

    if there is no edges to a[i] ("end of tentacle") — it shouldn't be chosen -> a[a[i]] should be chosen — remember, delete them, decrease in-edges count for a[a[a[i]]] do this while you can — you can keep vertices with 0 edges in the set and add them when some vertex becomes 0 in-edged

    ether everything is deleted or there is still untouched cycles

    if there is cycle with odd length — cout << "-1". You can understand this from a cycle of length 3

    if each cycle has even length — color them 1 0 1 0 1 0

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

    First of all we will try to identify what indices or elements are mandatory to come and what are mandatory to not to come. For this we can make a frequency array and if freq[x]==0 , x as an index can never come in p and because x can never come a[x] must come in uncircled elements and as an index too and a[a[x]] must not come as uncircled elements and so on .... considering all these facts, first of all we need to identify mandatory presence and absence.

    After this if there are any a[i]==i pairs or there are odd numberof indices left ans is -1 else an ans always exist.

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

In problem D the word indices should've been highlighted.. I wasted the entire time thinking that elements multiples of black elements will be colored green.

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

How to solve Div 1 C? I knew that it can be reduced to coloring nodes in a directed graph (in which outdegree of every node is at most $$$1$$$) such that for every node $$$i$$$, if its color is $$$0$$$, then, it must have outdegree $$$1$$$ and its outgoing node must have color $$$1$$$, otherwise, if its color is $$$1$$$, then at least $$$1$$$ incoming node must exist that have color $$$0$$$.

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

    Yes, that's basically the solution. The only additional thing is that cycles have to be handled carefully.

    Process each component of the functional graph individually, for each hanging tree, do subtree dp ($$$dp_{u, 0}$$$ stores if its possible to not pick node $$$u$$$ after picking/not picking nodes from only its subtree and $$$dp_{u, 1}$$$ stores whether its possible to pick it). The transitions are the same as what you have written (its possible to not pick a node if all of its incoming edge nodes are picked, and possible to pick a node if atleast one of its incoming edge nodes are not picked).

    Now, we need to check if a valid set of choices for the nodes on a cycle exists.

    Pick any one node on the cycle to be the starting node. Fix the choice (not pick/pick) for this particular node, and go along the cycle, maintaining similar dp states (note that these dp states must take into account two things: the last node on the cycle, and the hanging subtree). The transitions are almost the same as when we find dp values for only hanging trees. Check whether there is a valid set of choices for both choices of the starting node.

    Finally, you can just store backlinks and find the unpicked nodes to get the final answer. Unfortunately, my implementation is cancerous and belongs on r/EyeBlech.

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

When can I see others's code?I want to know the solve of Problem D...

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

Weak samples are OK for ICPC problems, but absolutely disaster for CF.

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

.

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

div2 C is there any trick?

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

What is test 7 in Div 1 D :(

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

After solving Div2 D, I have a strong feeling that D can't be solved by 2000 people itself in Div2, maybe heavy cheating is going on i Think

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

Is there a randomized solution for D1C? I was choosing an index that was not circled in the answer, the probability of an index X to be that index is >=1/2 so with about 20 chooses I fill find such index. Then I was trying to make an answer for it greedily.

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

Interesting, but strange solutions for D1CD

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

Was dvi2E doable with 2sat or am i trolling?

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

    My solution was like this:

    If we could find sush uncircled elements such that:

    1. for every uncircled element with value x there is circled element with index x

    2. for every circled element with index i there is uncircled element with value i

    Then it would be easy to find a solution

    We can also see that this conditions are neccesary Now we just need to add our conditions to 2sat We will have 2n variables Variables i, 1 <= i <= n will be : 0 — if we doesnt circle element with index i 1 — if we circle element with index i Variables i, n < i <= 2 * n will be:

    0 — if we circle all elements with value i

    1 — if we doesnt circle all elements with value i We can see that adding clauses is easy now

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

Div. 1 C was a strange one, I couldn't find the edge case on which I failed...

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

Why can't I submit a contest problem now? Is it always like this during system testing? I never tried before. I really want to submit 1E.

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

It seems that the score distribution of Div. 1 and Div. 2 are accidentally reversed.

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

The sample is too weak :(

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

aaa QAQ,i'm firstly loser!!!QAQQQQQQQQQQQQQQQQQQ

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

Totally not today's D.

Also it seems like that GfG post is only 3 weeks old lol (nvm, more like it's 6 years old)

If this problem actually appeared in the largest student-run IT event in Indonesia — that seems curious at the very least.

I am not saying that someone from the writers stole a problem, I'm wondering how nobody from the round organizers or the testers tried to google something like Sum of maximum elements of all subsets, that's literally the first search answer

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

    The 2 problems are very different though. There are plenty of problems with sum of max element of all subsets, just tat the condition for the subsets are different

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

      Everything is relative, but I can't agree with very different

      It's obvious that selecting an index $$$k$$$ is not worse than selecting any of the subsequent $$$kth$$$ indices, so for each $$$k$$$ we just update the value at that position with max of values on positions that are divisible by $$$k$$$ with $$$O(nlogn)$$$ time complexity (another way to notice this is to consider taking an index $$$1$$$).

      After this operation the problem is reduced to the one described in the article

      Personally for me the condition of the green and black elements felt more like a red herring

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

Can anyone please give a hack? I get WA on pretest 4 on problem 1C/2E

Edit: ignore my last sub please, try this

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

Any one can elaborate there E approach like will it is related to functional graph kind of think?

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

why the name effects of anti-pimples for problem D??

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

can anyone tell me what is wrong with my solution of the d problem in div 2 , 227195204

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

Failed to Notice $$$0\le a_i$$$ in D2D, I let $$$a_i=0$$$ if $$$i\mid j$$$ and $$$a_j\ge a_i$$$, which is wrong as I couldn't count the correct number of indices. However, I passed pretest successfully. Why not make pretest stronger?

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

For Div2 C how to visualize and find formula for k = 2 and k = 3

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

Video editorial for div2 — A, B, C and D with Code Walkthrough Youtube Video Link

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

is it just me or does anyone feel like Codeforces is giving less rating points than previously for the same ranks

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

I didn't participated during the competition, so I participated in the Virtual Participation.

But I wonder why the number "265" appears so many times in the examples.

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

Waiting for the editorial!!!!!!

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

As for the problem B in div2, my code got Pretests passed during the competition and got ac after the competition, But why does it show that I did not pass problem B ? Is there anything going wrong with the system?

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

Thank all of you,this is a great contest!

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

I really like the problemset for this contest :). Thanks a lot to the authors, only complaint is maybe d1b is a little bit boring, but it's still fun. I think my favorite is d1c.

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

I think div2's E is like a shit, not only without useful examples, but also with a misleading example

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

you can find number 265 in 1A's 1B's and 1D's test.

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

It was a good contest and I have learnt a lot of it and especially b and c were good problems