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

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

We invite you to participate in CodeChef’s December Lunchtime, this Saturday, 26th December, from 9:30 pm to 12:30 am IST.
Note the unusual time. It starts at 9:30pm instead of the usual 7:30pm

You will be given a total of 8 problems (6 in Div2, 6 in Div1) to solve in a duration of 3 hours.

Joining us on the problem setting panel are:

Problem Submission: If you have original problem ideas, and you’re interested in them being used in CodeChef's contests, you can share them here.

Prizes: Top 10 Indian and top 10 Global school students from ranklist will receive certificates and CodeChef laddus, with which they can claim cool CodeChef goodies. Know more here.

The video editorials of the problems will be available on our YouTube Channel as soon as the contest ends. Subscribe to get notifications about our new editorials.

Good luck and have fun!

As this is my first contest as CodeChef admin, I wanted to add few words from myself. Please do consider setting problems on CodeChef, we need your help to create great contests! One of the advantages of setting problems on CodeChef is that you don't have to create whole problemset by yourself (though it is certainly possible, you can write directly to admins to contest.admin2@codechef.com for LunchTimes and to contest.admin3@codechef.com for Cook-Offs). Many new authors can't create whole problemset without experience, and that's totally understandable! Sending problems for review allows you to get feedback for our admins (Um_nik, 300iq, jtnydv25, Ashishgup and Morphy), and if your problem is good, you will get the invaluable experience of setting a problem for thousands of participants worldwide while working side-by-side with some of the best minds in competitive programming. Some of the best problems in this contest are set by first-time problemsetters, at least on such a level, and they did a great job, I'm looking forward to working with them again.

Apologies to SeismicToss for messing up the announcement :)

The contest is unrated due to queue and server issues.

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

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

Should we start considering CodeChef as a regular place to compete xd?

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

    By problems you can, servers you need to risk it.

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

      Since revamping our judging infrastructure 8 months back, we have had virtually no issues with submission scalability, and can easily process more than 2000 submissions and IDE runs per minute. The issue with the last Cook-Off was that we were caught off-guard by the sudden increase in traffic, and it took time for the extra servers to be deployed. That is not a valid excuse though, and we apologize for the inconvenience. We'll make sure to have sufficient redundancies in the future :)

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

        Server down well this certainly aged well :\

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

          There Servers Are Not Working. Because, money is invested somewhere else, if you know, you know :P

          Also, similar thing was happens in last contest there was some bugs, i seriously feels so bad for problem setters and things like this happens :(

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

        "We'll make sure to have sufficient redundancies in the future." Yup, you totally did that.

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

        cLoUD SerVeR Go BrRrRRRrrrRrr ...

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

        We'll make sure to have sufficient redundancies in the future

        This aged poorly

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

        ;)

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

        Oof

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

        Ouch.

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

        I think you should stop trying at this point, we will give contests on CodeForces and AtCoder. You may continue on your conquest to monetize competitive programming on Unacademy and host Conversations with CodeChef on YouTube and while you're at it maybe start making video on Roadmaps as well like other “tech youtubers”. I understand there's no money in hosting competitions so it makes sense for a "For Profit" like you to not do it properly and place your resources on these. Also plagiarism issue isn't there on CF and AtCoder, you please continue on your path of becoming a “For Profit” with your “Parent” company Un-ethical-demy.

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

          You are being way too much harsh for just one contest , They had did many awesome works in the past , You should not forget them . BTW, I too don't like what Unacademy is Doing(Paid) , But Still they have done so many awesome things in past and are still doing it , You should take them into consideration before writing such a huge comment

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

        This is super disappointing. We became too confident about our judging capacity and so had way more test files than we usually do. Coupled with the large participation, we hit the limit which hasn't happened in the last 8 months. We are very sorry for the bad experience. We will be increasing our capacity in a couple of days.

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

          kitna chutiya banaoge translation : How much fool you will make us ?

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

            Bro, please don't use such words in a platform like this, if you don't like it just don't give those contests and move on, no need to harass people who make time from their busy schedules and make a contest for us. I too feel there's something off in codechef and would prefer codeforces anytime but I do respect both of them.

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

          Last few short contests were really interesting in codechef which was the reason for high participation in this lunchtime. But again said that, we would see decrease in participant in upcoming short contests on codechef because of today's issue. I think upsolving contests would be useful than waiting for judgement for more than 45mins.

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

          CodeChef_admin Seems like site is now up, Is there any possibility we can expect queue to decrease in next few mins? Else I think participants like me would upsolve problems later on. I am very much curious in checking my solutions for Even Sequence.

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

            Not in the next few minutes, no. By current rate, the queue will decrease somewhere close to the end of the contest.

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

        2020 came calling :)

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

      Time travel at its best :) Read my first comment at the top.

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

    tourist won 7 out of last 8 short codechef contests.

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

    Quality of problems has improved significantly recently, I enjoyed the last few contests, would recommend for participation :P

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

the queue was long in the cookoff and the contest was lagging so if you could work on it then it would be great.

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

    Yes, sorry about that. Please see the comment above regarding this.

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

      Please make the website contest ready before holding the contests otherwise it seems to be frustrating. If users such as Ashishgup would write a blog on cookoff then it is obvious that there would be a heavy crowd in the contest.

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

Reminder 1 — Contest starts in 1 hour, 45 minutes.

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

Queue :(

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

    We are working on it. Please continue to solve other problems.

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

      round should be unrated . I got WA verdict after 20 minutes which i could have fixed early if there wasn't queue . Also website loading too slow.

      Also please tell if it's rated or not now instead of wasting 3 hrs and telling after that it's unrated .

      WHY PEOPLE DOWNVOTING THIS ?

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

        There is no time penalty in Lunchtime, so you did not lose anything?

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

          But there is something known as contest rank and acc. to what I know one would be lower in rank (and eventually lower in rating) if he/she doesn't solves the problem faster

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

          Time taken to solve a problem is taken into account (Did CC lied to you about that ? ). I could have fixed that in 2 minutes but i fixed after 22 mins. So yes i lost 20 minutes which i didn't deserved.

          Please make this unrated to recognize your fault at least . And please fix CC before hosting any rated round . It's now habit of CC to waste other people time.

          In div1 solving A,B fast mattered a lot and this queue ruined it.

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

          I was wrong, the time of last submission is used as a tie-breaker. Sorry.

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

            Not offending you but curious how you became admin without knowing codechef contest rules ?

            Also please make problems well balanced . First 2 submission 600 and 3rd only 35 . It should have been like 600,300,100 to be a well-balanced problem set.

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

              I'm not writing rules or configure the system to enforce these rules. My job is to choose problems and make sure they are well prepared.

              I know that IOI-style ignores time of submissions, so I assumed that it is the same here. I was wrong.

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

                Sir, I admire you. But, We Know the fact that why So Many Grand masters are interested in CC, money! And, it is ok.

                Also, i agrees that Question's Quality is good now, but don't just promote them blindly !!

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

            Ok

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

              I don't think you can judge difficulty gradient by contest that was basically stopped after 1 hour.

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

              Submission count of 3rd and 4th problem is low due to long queue of submission in first two problems. Even i found 4th problem easier than 3rd one. But we can't judge on submission count

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

                how to solve 3rd question?

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

                  I reduced the problem to find longest subsequence such that every segment of equal elements is of even length. And that is just simple dp.

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

submitted b 20 minutes ago still in queue.

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

Judge is too slow .

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

CC Judge..Please stop keep running and take some rest.

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

When you waited 15 mins for your submission and the website shows "unable to connect to codechef server" :(

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

And here goes the queue...

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

its working very slow .

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

My solution for SWAP10HG has been stuck for 40 min now T_T

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

    When I first submitted, it had like 100 submissions. Still showing server error.

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

Please declare it unrated now. It (judge servers) has reached the heights of all frustrations now!

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

Anyone facing queues ?

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

Unable to connect to the codechef servers and then you are allowed to make one submission in 120s

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

cc is the internet explorer of the programming websites.

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

I trying to submit a problem for 30 minutes. but codechef do not want to take the solution. xD

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

Ok now you can't deny the fact that it is getting frustrating now. Please make it unrated.

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

The codechef server is not loading. I have been waiting for 25 minutes to submit my code

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

Site loading too slow.

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

Make this shitty contest unrated! Unable to connect to codechef servers

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

Everyone when 300iq didn't make many tests last Codechef:

"Weak tests! Bad problems! So easy to cheese!"

But actually, he was just trying to lessen the load on the queue. Truly a 300 iq move.

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

Codechef is only focusing on their unacademy course.

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

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

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

    Thanks for making it unrated now (after half the time) otherwise its really disappointing if a contest is declared unrated at the last moment.

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

    Can you please also announce this on codechef contest page too? I don't think every participant is following this announcement on codeforces.

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

codechef should do something because there are only two short contest in whole month and issue like this in those contest is very frustrating for all participants.

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

That was not a good way to end the year.

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

Codeforces smoothly handles over 15K participants every contest , to the contrary , cc can't handle even half the load...

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

    I think it is probably because of cf has pretests

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

      CF also has features like hacking phase, announcements for which we get notifications, we can ask our doubts/questions to the problem setters, leaderboard that updates in real time unlike every 1 minute or so and a leaderboard which accounts for people who have 0 correct submissions too. Also CodeForces is non-profit where I have seen only HarbourSpace sponsoring rounds and imho that is fine. CodeChef is blatantly supporting a scammy educational institute and yet still does not want to spend on their servers. They also offer certificates for money which cost a lot. You would think after all this, they would have better servers compared to CF.

      inb4downvotedbyindianfanboys

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

        Why do you think Unacademy is a scammy corporation? Have you EVER been to their youtube channel to see how much free material they have uploaded there? Every corporation that asks for your money isn't scammy. Byju's and WhiteHatJr might be scammy but unacademy is definitely not.

        Also codechef was only recently acquired by Unacademy. They asked Errichto to criticise them and tell them whats wrong. So they surely want to improve. Just give them their time. Its not like Codeforces didn't have any server problems in the past. Also, codechef is also non-profit. They don't tell you to buy their coure. They ASK you. Its completely upto you if you want to buy them. They dont even spam their homepage asking you to buy their courses.

        Call me an Indian Fan boy but I disagreed with your comment and downvoted it :-)

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

Contest Authors just wasted their problems. It would've been nice if this contest was on cf. :'(

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

What a way to end the year, CodeChef!

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

[user:CodeChef_admin,2020-12-26]Does contestant got laddus in an Unrated contest in codechef? Anyone knows about that? CodeChef_admin

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

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

    That is just happening from last 2 contest not every contest, you should not make such huge comment on the basis of a few time error

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

ahh, it was a cool problemset :'(. First atcoder doesn't allow to participate now this happens :/

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

    same feelings

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

    XOR palindrome problem was cool?

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

      Is it not?

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

        (I didn't want to answer before I got AC and the contest ended)

        I didn't mean to say it is a bad problem, just not very interesting. To me most of the time it was just somewhat tedious DS bashing.

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

          I thought it is an awesome problem with two nice observations and pretty simple implementation with trie. Maybe we have different solutions.

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

            Ok, there's a nicer solution. Then I won't complain. It is possible I overcomplicated — I had lazy propagation on a compressed segment tree (with custom operations).

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

I really feel sad for problem setters , there were so nice problems , queue ruined their efforts

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

you should give us more time and solve the server issue.Not making this contest unrated will solve the problem

»
4 года назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится
only For Indian
»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Stop spreading hate so much for CC, Don't forget what they have done for CP in Past in India.

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

Its very bad to see ppl cussing codechef, there can be problems like these and it happens in codeforces also (maybe less no. of time)... but I hope cc will show the reason officialy.

I am saying this is bad bcz, at first someone pay the authors to create contest for u to participate in and if something wrong happens than its totally their mistake... maybe they had judged it all wrong like no. of ppl and no. of files.

Actually as one of guy in comment was saying above, it more of seems very interesting case of how ur servers can get overwhelmed with these type pf things which no one can think of.

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

Is CodeChef worth giving the contest?? I had my submission queued for 25 mins. XD

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

    Yes, I strongly feel so. U need to experience a variety of problems. There is some pattern of problems and so the diff. b/w cc and cf. If u want to do it right way then I think u should practice problems from 2-4 diff platforms (while giving time to good problems not just solving easy everywhere).

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

      I totally agree with kesh4281 usually I have noticed nature of problems in codeforces and codechef are slightly different which really helps in learning.

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

.

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

Even though contest is unrated, do try Sum of Digits — https://www.codechef.com/LTIME91A/problems/SUMDIGIT. It has been made with a lot of work.

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

Offcourse, we want codechef not queuechef

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

Will we get verdict this year or in 2021?

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

Me after getting WA after 52 minutes in queue- meme

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

how to solve even sequence problem??? any hint.. problems were really awsm....

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

    Try using DP with 2 transitions, first transition is getting 2 equal number, and the second transition is delete the current number (delete a number and insert extra number to get a pair has tha same cost) .

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

"An even sequence has the following property: each maximal contiguous subsequence which contains only equal integers (i.e. the same integer repeated a number of times) has an even length. In particular, the empty sequence is even. A subsequence is maximal if it is not contained in a larger contiguous subsequence which contains only equal integers."

The example says seq "112" is not an even sequence. Why? The definition says it is.

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

    equal digit length should be even in this case length of digit 2 is not even -> "only equal integers (i.e. the same integer repeated a number of times) has an even length"

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

      Each maximal contigous subsequence...

      The 2 is obviusly not maximal.

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

        Yeah it is — it is not contained in any larger contiguous subsequence which contains only 2.

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

          how to solve this problem??

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

            Solution for Even Sequence: Dynamic Programming.

            Main intuition: Deleting elements is beneficial only when you are merging two disjoint subsequences whose elements are equal. To do so, it is beneficial to always pick the nearest such subsequence. Otherwise you can only add elements.

            First of all, condense all maximal contiguous subsequences. Then maintain answers for $$$dp[id][parity]$$$ which is equal to "the minimum cost such that i have processed till index id and all maximal contiguous subsequences are even except the last one, the last one has parity equal to the parity in the state".

            For transitions: You can either choose the immediately maximal contiguous subsequence OR you can choose the nearest previous contiguous subsequence whose elements were equal to the elements of the current contiguous subsequence. (You will have to use some optimizations like prefix sum for full score, also you will have to keep track of the last occurance of each subsequence)

            The answer is obviously — $$$dp[number of subsequences][0]$$$

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

Can anyone explain why is the answer for THREE (Three Letters) equal to $$$\displaystyle \text{min}\Big( \sum_{c \in A} \Big \lfloor \frac{f_c}{2} \Big \rfloor, \frac{|S|}{3}\Big)$$$ ?

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

    you can create a palindrome using only two ways.

    1st three same characters and 2nd 2 same characters and one different. So maximum number of palindrome of size 3 we can create is ∑c∈A⌊fc2⌋. Also it can't exceed size of string/3 so take minimum.

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

      Thank you for replying.

      I understand that these two things give two different upper-bounds on the answer, but can you prove why is the answer exactly the minimum of those? (i.e. why can't the answer be any other value that is lesser than those two things?)

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

        Can any of the admins comment on that, please? I am still unclear of the proof of the formula. Um_nik, Ashishgup

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

        Assume, you have an array of length n and there are x (x <= floor(n/3)) pair of numbers such that both of them are equal, you'll always have x numbers to insert between them to make them 3-length palindrome.

        Example 1:
        Example 2:

        So basically, you can never run out of the number of elements to insert between such pairs if x <= floor(n/3).

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

I wrote a greedy solution to even sequence solution link

Can anyone tell me any case of failure.

My rough approach is to maintain a set of all odd length numbers we got. If the next sequence is of even length and that number is already present in set than remove all other element and add to answer and only keep that element else just remove all the element from set and add to answer.

If sequence is of odd length then add only to if it's length if of 1 and if it's already present than add to answer size of set — 1 and clear it.

P.S. — I got AC but still asking because everyone wrote DP, So greedy maybe wrong.

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

    Yeah my original solution was greedy as well, it basically depends on how you solve the underlying interval covering problem :D

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

If any one is stuck at even Sequence can watch this- https://youtu.be/EoQhlHe6PYA

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

Problem : K-Tuple Tree [Inclusion-Exclusion]

Did anyone try solving it using inclusion-exclusion principle? The idea is to first break the graph into different component by removing nodes labeled with 0 color. And then to calculate inverse, i.e total ways such the condition does not satisfy, i.e there are ATLEAST two nodes belonging to same component. Subtract above from total ways of assigning and you get the answer.

I was able to pass 4 subtasks but got WA on rest (for k > 3 I guess). I think there might be something wrong with my formulation of inclusion-exclusion. Can someone please help me with the solution?

Problem link : https://www.codechef.com/LTIME91A/problems/KTTREE

Solution link : https://www.codechef.com/viewsolution/40859580

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

Can anyone tell me what's the answer for problem Three Letters for case:

1 xxxyyyabc

To me it seems answer should be 2 but my code shows 3 & i got AC !!

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

Do you guys have any idea about this DIV-3 thing on codechef?