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

Автор amul_agrawal, 23 месяца назад, По-английски

Namaste Codeforces!

We are excited to invite everyone to CodeCraft-22 which will take place on May/31/2022 17:35 (Moscow time). It is rated for all people who are below yellow! (rating under 2100)

The Programming Club at IIIT-H organizes this event under Threads'22, as a part of our techno-cultural fest Felicity, IIIT Hyderabad.

There are 6 Problems with 2 hours to solve them. The scoring distribution will be released soon!

We have worked hard to keep the statements clean and the pretests strong! After the contest, step-wise tutorial and video tutorial will be released along with the code!

We hope you enjoy this contest!


UPDATES

Score Distribution: 500 — 750 — 1250 — 1750 — 2250 — 2750
Editorial is out.

Winners

Congratulations to all the winners for such an amazing performance.
Global Top 5
1. tourist
2. ksun48
3. noimi
4. jiangly
5. Um_nik

Official Top 5
1. JrNTR
2. YinJinRun
3. Remakee
4. see_wo
5. HowtobeRed

We will send a CF personal message to the winners of the T-shirts soon.


PRIZES

The following twenty lucky participants receive a T-shirt:

  • Top 10 Indian participants.
  • Random 10 from top 100 (ranks 11-100) Indian participants.

These ranks are determined from the combined unofficial rank list. People who have their Country set to India in their CF profile will qualify as Indian participants.

We are giving T-shirts to Indian participants only to avoid logistic issues that we have to face during international delivery. We apologize for this limitation, we will try our best to bring international prizes too from next year.


Thanks to NEAR for supporting this round, details can be found in this post.

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

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

All the best everyone

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

    What F*ckhead created problem C ?

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

      It is an interesting problem, I think. I solved it, and it seems very easy after you solved it (it is not sarcasm)

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

      Whats wrong wid it..? It is really a good problem and if you could not solve it, that does not mean problemsetters are bad. Infact they are really good.

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

        There are "hidden" edgecases in the problem that makes it frustrating for the ones not seeing them. That does not make it a bad problem, but explains the frustation.

        In this case the more obvious edgecase is that there can be less than 2 '1's, the less obvious edgecase is that by limit of $$$k$$$ the only valid move is moving the one '1' to the left.

        However, I also do not think that such "edgecase hiding" problem statement is a good problem per se. It remainds me more of a chrismas riddle than a serious problem.

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

An indian contest, we expect a lot of math problems!

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

    You showed us how to get a negative contribution in the fastest time.

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

      Ngl, as an Indian, I don't get why people were offended or whatever. The comment wasn't that bad, imo

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

what is the meaning of orz.

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

Just take a moment to appreciate how cool the poster design is. Also where will the video editorials be posted ?

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

Feels good to see myself under sponsors:)

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

Since this event is sponsored by EA, how many dollars needed to unlock problem B?

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

Hows is this made possible , i mean the organizing and stuff

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

Hope to see brilliant problems, hope new colors for all

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

Why only Indian?

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

    The prizes are only for Indian participants to avoid logistic issues faced during international shipping.

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

Hope some positive rating change. Have become pupil from expert in the past few contests.

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

Namaste Codeforces!, Great to see the Indian contest

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

Time to change my profile country to India.

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

Done

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

upvote or bad luck for this contest

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

Tis gonna be crazy..IIIT HYD (One of the best institutes in INDIA ) <3

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

Although this is an Indian game, I don't think the following conditions are very reasonable...

Random 10 from top 100 (ranks 11-100) Indian participants.

Can players from other countries also participate?

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

    Hey!

    I am really sorry. This year our logistics allow us only to deliver T-shirts within India. For future years, we will try our best to bring international prizes too.

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

Hello amul_agrawal To count as an Indian participant, do you have to live in India, or simply be of Indian heritage?

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

    Hey!

    Thank you for asking this, I realize that the prize distribution which is written in the post is indeed a little unclear.

    The purpose of giving T-shirts to Indian participants only is to avoid the logistic issues that we have to face during international shipment. Hence, by the Indian participants, we mean the people who have a home in India, so that we can deliver the T-shirt there. People who have their Country set to India in their CF profile will qualify as Indian participants.

    Apologies for this confusion. I will update the blog soon with this detail.

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

on account of the overwhelming interest of competitive programmers to avail this round's T-shirt, here is a helpful link.

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

It is the time to see my new color wish me luck (:

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

Very Excited for this Round !!

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

Expecting a good quality ques and super excited for the round.

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

wanna hit specialist so bad wish me luck

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

    Becoming specialist today means speed-forcing A,B,C. Let's see if you can?? Hope for the best . Prepare for the worst

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

The scoring distribution?

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

How's The Josh guys?

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

all the best guys, hope to see your colour change

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

Very interesting D

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

    hint?

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

      Problem requires multiple subtask.

      Subtask 1 hint: In which subarrays element at index i will be the maximum

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

      define l[i] as the max index such that l[i] < i and a[l[i]] > a[i], r[i] as the min index such that r[i] > i and a[r[i]] > a[i]. Then for each i you need to find indexes l' and r' with the max sum of a[l';r'] such that l[i] <= l' <= i and r[i] >= r' >= i.

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

lmao. Was C so easy that so many people solved it? Implementation seemed so difficult.

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

Can someone please tell me what's wrong with my code for problem C? https://codeforces.com/contest/1691/submission/159053938

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

 I think we need to block meggage when ongoing contest. Ban++!

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

    I started codeforces recently and got super mad at cheaters but now I stopped caring. It happens every contest man. That’s why no one responds anymore. There are too many cheaters to do manual check, and they just find ways to trick the plagiarism detector anyway. It stops matter once you solve D or above

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

      If there is an opportunity to ban a sussy baka cheater, then why not to use it?

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

boring ABC, D classic segment tree. Thanks for the round!

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

    did without segment tree code

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

      how?

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

        1-> there cannot be 2 consecutive positive values

        2-> replaced consecutive negative values with their sum as a whole they don't change the result

        3-> not considering the values which are zero

        4-> only checking till 3 length subarray by contradiction we can prove that
        if more than 3 lengths give us no we can do it in 3 or less than 3 lengths (but I checked till 50).

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

          4 -1 -1 4. How can we do in 3 length subarray? Is there something I am missing.

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

            He said that he is replacing all the consecutive negative numbers with the sum of them. Anyway, that approach fails for this:
            1
            9
            12 -39 44 -36 30 -14 8 -9 18

            I had to submit it again and lost around 400 points, also I could have completed E if I had not seen that test case after submission.
            Very unlucky day for me :(
            Still not sure whether my solution for D will pass or not

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

          Can explain more on how this work? like if the testcase is 5 {-4 4} {-4 4}...(same for n times) 5, can it still be processed?

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

        I did it using a slightly modified Kadanes, where I checked if:

        (Max sum till index) $$$>$$$ (Max element in subarray under consideration) $$$\forall$$$ $$$i$$$ $$$(a[i]>0)$$$

        and then checked the same in reverse. I don't have a proof to why this worked, just intuition.

        Code

      • »
        »
        »
        »
        23 месяца назад, # ^ |
        Rev. 5   Проголосовать: нравится +2 Проголосовать: не нравится
        • lemma 1 : we should not have 2 consecutive positive integers
        • lemma 2 : consider 2 positive integers [a, b] which appear next in order in the array having a segment of negative integers between them whose sum is say p ie : a p b then max(a , b) >= a+p+b this we can check for all such segments.
        • lemma3 : consider 3positive integers [a, b,c] which appear next in order in the array having a segment of negative integers between them whose sum is say p1 , p2 ie a p1 b p2 c now among all the possible combination of order of max value of [a,b,c], we need to check for the case , where b is the smallest among all three. for other combination we can boil down back to lemma 2 (a p1 b , b p2 c) [you can do a little math ;)] so i checked for case of 3 numbers too
        • lemma 4 : n>3 positive integers can be broken into lemma3 then lemma 2 , so we don't need to check more .

        hopefully doesn't give FST

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

        I was thinking of using the maximum stack technique.

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

      Explain please

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

    How is D giving AC for some solutions with O(n^2) time complexity for other with completely similar logic

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

Approach for E?

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

    Do a classic sweepline. The main observation is that if at some moment during the sweepline there are open intervals of both colors, then all those intervals will be in the same connected component. Therefore, if there's a moment with both colors present, it's enough to unite all active intervals, and keep the interval with largest right endpoint of each color. Notice that during each moment in the sweepline, the set of active intervals will be either unicolor, with each interval belonging to a different connected component, or both colors will have one active interval. Therefore, when encountering a new interval it's enough to unite it with all intervals of the opposite color, and the complexity will be $$$O(nlogn)$$$.

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

    I like overkilling tasks, so here is my approach, but it's basically the same as previous answer. Let's create a segment tree, for every red segment we will add it to vectors of nodes covering this segment. So it's standard adding on range operation, instead of increasing some variable, we're pushing to vector. Now, for every blue segment iterate down the tree. When you're in some node, add edge to every red segment in this node, now all of them are connected, so it's enough to leave only one of them in vector.

    Repeat this approach for blue segments stored in tree and queries for red vertices.

    Now you'll get something like n * log(w) edges, where w is maximum coordinate of segments. So you can do standard DFS now.

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

Approach for C??

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

    Just tedious casework...

            if(L && R && L + R <= k && cnt > 1) {
                cout << ans - 11 << "\n";
            } else if(R && R <= k) {
                cout << ans - 10 + !(L || cnt > 1) << "\n";
            } else if(L && L <= k && (R || cnt > 1)) {
                cout << ans - 1 << "\n";
            } else {
                cout << ans << "\n";
            }
    

    Here $$$cnt$$$ is the number of $$$1$$$ bits, $$$L$$$ is the distance from the beginning to the first $$$1$$$ bit, $$$R$$$ is the distance from the last $$$1$$$ to the end. And if $$$cnt=0$$$, output $$$0$$$.

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

      I mean, it's also possible to brute force all possibilities if you're lazy. The result only depends on the first and last digits.

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

    sum is minimum only if there are 1's on both the end points, for example: 100001 is better than 010100. Just check for closest 1's to index 0 and index n-1 Also priority should be first 1 at n-1 index than at the 0th index

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

    Every element except 1st and last element contributes at ones place and tens place. Last element contributes only to ones place. First element contributes only to tens place

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

GeeksForGeeks have working challenge (impossible) I tried this code for but couldn't get it to work.

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

The most ridiculous mistake I ever made was in today's E. I used the following function to check whether two intervals are intersecting.

Function

The intervals are passed by reference, and therefore change the order of the intervals in the original array. Fml :)

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

For me A,B,C where simple to guess but hard to prove.

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

    B can be proven by noticing that if there's at least an element that's unique in the array, then you can't swap it with anything. Why? Swap with a smaller is disallowed, and swapping with a larger element is also not allowed, bc the larger element now has the smaller element. Then just swap indices with the same integers, a way to do it is in the example.

    For C, any 1 that is not at 0th or n-1 index will add exactly 11 to the sum. So you just have to try to move a 1 to the back first, and then to the front.

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

OMG. It was my first contest in codeforces and I totally failed. In Problem B, I made sections with each size. like [1, 1,][3, 3, 3] by searching with Two Pointers. And I flipped the idx in each section. In upper example, the answer will be [2,1][5,4,3].

Then I got WA in pretest 1. I'm really curious about Problem B.

Why my submission failed in Problem B?

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

    Cuz if u flip the idx of a section with an odd amount of people, the middle person in the section has the same shoe as before. In ur example, person 4 gets his own shoe back.

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

    Bro read community guidelines. Don't post full code directly. Post in either spoiler or post link

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

What did I miss for problem C? 159077051

Will be grateful for an explanation :)

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

solved D for the second time(last time got hacked). Hoping not to get fst today.

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

Start the goddamn system testing, I want to send my code.

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

Misread B, moved on. Failed C, moved on. Solved D in 20 mins. Went back to C, but still failed. Went back to B, and understood that I have misread it, yet failed again. What a round... I am quite confident about my solution for B (also for C but whatever), but I get WA in case 3... any help? 159066034

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

Is problem F kidding? I think it's even easier than problem C,for which I will consider its difficulty as *1700.

And I also would like to know why I got TLE on pretest 2 (the given sample to which the answer is 849) at the first attempt (nothing wrong with it in my PC) , and after I add two "inline" ,I got an AC.I think it may be the judge's fault, not mine.

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

    Your pretest 2 fails not because of the judge but seems like it's the compiler. You are probably running your code with no optimizations. Try adding -O1 (or 2,3). It segfaults. Exploring why this happens further.

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

      plz can you tell me more details about it? for example how i can add -O1(or 2,3),and why i haven't encountered any fault like this when solveing other problems before?

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

        I'm not able to find the assembly to show you but the problem is that you use scanf("%d%d") instead of scanf("%lld%lld") (which clangd will warn you about :D). I'll try to find the exact assembly diff if I can, but this is the major problem.

        The reason your second code passed is that you luckily used some other I/O way. inline is usually useless in the same file, compilers are now smart enough :D

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

159066950 why i am getting mle on this code question b

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

    plz never use unordered_map.

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

      159039176 can u also tell me why i got runtime error on this code

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

        You always need to read all the input per test, even if you know the answer before it's all read. When n is 1 you return early and all the following tests will be read incorrectly.

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

        when n = 1 you should read the number $$$a_1$$$ .

        for example, the input is :

        2 1 5 3 1 2 3

        then you will find that your code reads "n = 5" in the second test case.

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

Problems were really very good and contest was very well balanced, Kudos to the problemsetters

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

Cheesing D by just checking some of the intervals. Happy hacking!

https://codeforces.com/contest/1691/submission/159019206

EDIT: Hacked by tourist, I'm honored!

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

For problem B can anyone tell me why this code exceeded time limit for test 30? this is O(n) solution. Link to the solution. https://codeforces.com/contest/1691/submission/159016521

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

I made the array smaller and RE on test 30 of problem B,that i can't go blue this time,f**k the fst!!!

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

D was interesting Any simple solutions without segment tree ?

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

Isn't problem F too easy? The rerooting solution is so obvious, although the top rankings' solutions seem to be shorter.

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

E is waaaay easier than D. One more confirmation that proper tactic is to "read all the problems"

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

    Nope, D has 4 times more solves than E. It's your personal opinion.

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

      Of course it's my opinion. But nobody knows how many solves it'd have if swapped with D: do not forget that majority solves A->B->...

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

    I thought so too

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

I think the test set for problem D are not strong enough because I just tried a brute force kind of solution and it passed.I would request to rejudge Solutions with strong test set.

Here is my solution : https://codeforces.com/contest/1691/submission/159082582

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

159067765 this solution should be wrong. For test case:

10

100 -30 -20 50 -30 -20 50 -30 -20 100

It should give "NO". But the solution give "YES".

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

This code for D got AC after the contest had finished, can anyone prove why it works?

https://ideone.com/mnFtIx

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

My brain during contest:

Spoiler (Problem C)
»
23 месяца назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится
Noticed?
»
23 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is it allowed to add the test case by authors during the contest? Or only test cases which were used to hack is added automatically?

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

Hey amul_agrawal, akcube and others from the team.... The post says "It is rated for all people who are below yellow! (rating under 2100)"

However, after the contest, my rating has not changed... I assumed this was because solutions were not checked on main test cases yet, but that process is now complete.

I can see this contest under "Unrated Contests" on my profile... why is that so? I thought this was rated. It was a fantastic contest and I had a lot of fun trying my hand at the problems, thank you. It is not a problem even if it is unrated, I was just expecting it to be rated for me, since I am below 2100 rating.

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

Why these O(n^2) solutions pass? Is there any additional neat trick that will reduce the complexity?

Submission 1 Submission 2 Submission 3

UPD: okay 2 of them hacked, the last one's is still AC

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

Oh god! I'm getting nervous for A and it's setting up or spoiling my mood for the rest of contest based on whether pretests of it are passed or not.

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

What is uphack? I still got AC after being hacked in problem D. Even the rating changed. I don't understand. Someone please explain if you know something. This my submission for D

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

    According to me the hacking is open even after the contest ends for those who have rating greater than 1900. Your code has passed the the testcase provided by the contest writers but there maybe some testcase on which your solution may give Wrong Answer or Runtime Error or Time limit exceeded on which your code got hacked.

    Later these hacking testcases gets merged with the system testcases, so if you will try to submit the same code after some time you may get WA or TLE.

    I am not sure of the rating changes though, according to me they will be updated after all solutions are re-judged.

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

      No. Uphacking doesn't change contest result and rating changes. It is for adding test cases for future practice submissions or virtual submissions. It doesn't rejudge contest submissions.

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

I am never rerooting again :')

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

    nice profile pic and name bro.. only indians can have this much of creativity

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

      to get so many upvotes just say something about india and indian user will show their presence :)

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

    I dont think it needs so complicated transformation?

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

      Yup, It can be reduced to half it's size. I maintained dp states in a little more detail than i needed

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

        I only kept the size of each subtree if the whole tree is rooted at 0, then do some calculation.

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

Indian students and colleges are organizing such contest . Great to see that indian education system is improving :) | but this will never happen in tier 3 :(

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

how can one know if he/she has won the random tshirt between 11-100 rank, i am ranked 64 is there any form to fill? or way to know?, this is my first time so pls help.

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

The idea for A was so straightforward and I had to use pen and paper and only got the right approach half an hour into the contest

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

Please any1 explain the C problem.I am not able to understand the tutorial :/, what he is exactly trying to do.

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

    The idea is to look at the contribution of each $$$'1'$$$ to the value of the string. Fix some string $$$s$$$, for example $$$s = "100101"$$$. There are three types of positions that a $$$'1'$$$ could occur in:

    1. Middle position: some $$$0 < i < n - 1$$$ with $$$s[i] = '1'$$$. Notice that such index appears in two substrings of length two: $$$s[i - 1]s[i]$$$ and $$$s[i]s[i + 1]$$$. In the first one, the $$$'1'$$$ will have value $$$10$$$ and in the second one, the $$$'1'$$$ will have value $$$1$$$, resulting in a total contribution of $$$11$$$ to the total score.

    2. Leftmost position: $$$i = 0$$$. In this case, the $$$'1'$$$ is only a part of one substring: $$$s[0]s[1]$$$, and its contribution is $$$10$$$.

    3. Rightmost position: $$$i = n - 1$$$. In this case, the $$$'1'$$$ is only a part of one substring: $$$s[n - 2]s[n - 1]$$$, and its contribution is $$$1$$$.

    Notice how since the number of $$$'1'$$$ s doesn't change in swaps, the best thing to do would be to lower the contribution of some $$$'1'$$$ s in the string. So, we will first try to bring some $$$'1'$$$ to the rightmost position (since its contribution there would be the smallest), and then, whether it succeeds or not, we try to bring some $$$'1'$$$ to the leftmost position.

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

For task D, there are many O(n) solutions, which doesn't seem to be really correct (I can see they have been hacked after contest had ended).

So I have 2 questions:

1) How to make a hack after the contest has ended? I can't find any possibility on codeforces gui.

2) Is it fair to keep ratings unchanged, knowing that "valuable" task was accepted and points were counted by a mistake (or, speaking more rude, by contest authors fault — weak system tests) ?

  • »
    »
    23 месяца назад, # ^ |
      Проголосовать: нравится +10 Проголосовать: не нравится
    1. This is known as Uphacking, available to Div 1 participants, you can check Mike's blog about it.
    2. The official rating and ranking is not affected on the basis of uphacking, but in this case, since the Main tests allowed even O(n^2) to pass, I believe they should be rejudged, rest all depends on Mike and the contest authors!
»
23 месяца назад, # |
  Проголосовать: нравится -13 Проголосовать: не нравится

I do not like this contest i quit codeforces

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

    Yeah sure u can.

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

Why is this contest suddenly unrated for me all of sudden? (Although I spoiled this contest very badly)