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

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

Hi everyone!

It has been almost 2 years since I joined Codeforces, and it has been a great journey as a contestant. I now try to take a shot at problem-setting with my friend Mahir83.

With that said, I bring to your attention my new Codeforces Round 508 (Div. 2) that will take place on Sep/06/2018 18:35 (Moscow time). If your rating is less than 2100, this round will be rated for you; otherwise, you can participate out of competition.

I would like to thank Mahir83 for his help with preparing problems, cdkrot & 300iq for coordinating my round and Um_nik, craborac, vintage_Vlad_Makeev, vovuh & BledDest for testing my problems. I would also like to thank MikeMirzayanov for Codeforces and Polygon platforms.

You will be given 6 problems and 2 hours to solve them. Scoring distribution will be announced later.

Good luck!

UPD: Scoring Distribution: 500-1000-1500-1750-2250-2750

UPD2: Editorial

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

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

Please put this blog into HOME.

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

Wow,an indian as a problem setter without any fest of their institution :))

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

this will be amazing

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

Sadly, another midnight contest for chinese participants.

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

If your rating is less than 2100, this round will be rated for you.

Codeforces says: You are registering "out of competition", reason: rating should be between 0 and 1,899 in order to register for the contest.

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

Ashishgup i hope you saw round 507

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

All the best Ashishgup!

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

two consecutive contest in two days! it is wonderfull. (the day after tomorrow will be educational contest so three consecutive contest.) thank you codeforces .

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

I am very excited about the contest by Ashishgup.

Because of this blog on Quora.

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

How to approach D?

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

congrats Ashishgup

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

Indian problem setter on Codeforces. This seems to be the start of an era.

This is sure going to be fun! Looking forward to more such rounds!

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

I hope, we will see some interesting problems in this round.

And, Ashishgup congratulations for your first contest as problemsetter...

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

I joined Codeforces for over 2 years and even not enough color to be a problem setter...

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

Hope for strong pretests. X3

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

Hope to see a great blend of classic problems involving (dp,algo,ds,numtheory etc..)in a single contest:D

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

20 min to go !! :D

Best of luck Ashishgup for your first contest as problemsetter. Looking forward to a really nice set of problems. :)

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

strong pretest

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

CF so slow can't load other people submissions

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

feel stupid enough to ask this type of questions again, yet I have no choice

How to solve D? :(

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

Thanks for the n = 1 pretest in problem D! :D

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

How to solve D please ?

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

How to solve problem E? >_<

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

Maybe it's first time in my life when it isn't nessacary to know anything (except sort()) to solve Div2 A, B, C, D... But... somehow they were very interesting!

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

what is pretest 16 problem D

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

What was the hack for D?

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

Any "Hint" for problem E ?

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

E was an interesting problem... but it took me a bit too long to implement. Is there a simpler solution than a dp with n*2^4*2^10 states?

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

Congrats for an amazing contest!

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

What is case 15 in problem D?

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

Can E be done with max cost max flow?

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

How to solve B?

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

In problem C
100000
1000000 1000000 1000000 . . .
1 1 1 . . .

Why this was a wrong/invalid hack? Link

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

Nice problems by Ashishgup.

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

E is bitmask ,right?

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

I need 35 to go back to DIV. 1, predictor says if all my solutions are accepted I will get +36 :D

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

Why God ??

I did all things right but then shitted while typing in Div2-D. I calculated difference and max_difference correctly and then instead of using max_difference for calculation used difference instead :(

Submission: https://mirror.codeforces.com/contest/1038/submission/42588288 JUST LAST MINUTE THINGS !!

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

Hi, I have a doubt regarding problem A. My code gives the required output on other IDEs as well as on my system. But on codeforces it is showing wrong verdict for pretest 1. Can anyone help me ? My solution link is : https://mirror.codeforces.com/contest/1038/submission/42582475

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

Solved D, but was defeated by pretest 3 on A? What's going on there?

Please, SEND HELP!

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

how to solve E?

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

Is it just me or for the past 2 weeks during contests CF is taking too much time to load??? It's like...it's fine right now and 5 minutes later, it's not loading. And then it suddenly loads. Anyone?

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

Can someone share their library code for min cost max flow with negative edges and negative cycles which I believe is implemented using Bellman Ford irrespective of whether today's E has some other solution.

Thanks!!

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

One of the best codeforces contests ever!!!

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

Intuition for Question C?

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

    In terms of score difference it doesn't really matter to take your number or to erase your opponents' number. So you always want to deal with biggest number of both lists: if it yours you take it, if it opponent's you erase it from his list

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

    Its based on this optimal strategy from a player:

    1. If I don't have any element, I would delete the largest element from the list of the other player.

    2. Else If the other player doesn't have any elements, I would simply add the largest element in my list to my sum.

    3. Else if the largest element that I have has a greater value than the largest element of my opponent, I would add my element to my sum. Since if I go for deleting the largest element in my opponent's list, he would in turn delete mine and I will have to incur a greater loss. However, if I add my current largest element to my sum. Either my opponent will delete some no. in my list that has a lesser value or he will add to his own list an element that has a value <= the value of my element. In case my new difference would be >= my previous difference.

    4. Similarly, if other player has a larger element than the largest element I have, I would go for deleting the element in his list.

    All this can be simulated by using 2 vectors, 1 for each player and sorting both the vectors and accessing only the last elements of both at any instant.

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

The strong pretests. I like it :)

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

Thanks for the nice contest.

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

Well balanced contest with interesting problem set. Clear and concise statements. Good job Ashishgup :)

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

The pretests were great, but IMHO, the contest was a bit on non-algorithmic side. A bit disappointed with this.

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

    Disappointing that you value the already invented algorithms over logical thinking!

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

      if every problem is just logical thinking then you will actually not learn much.. applying multiple "already invented" algorithms or modifications of them is what problems should aim on in my opinion.. I appreciate Ashishgup for the problems as it is not easy to come up with original problems but I hope next time he will amaze us even more.. all the best!!

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

        To be fair, the tag-wise distribution of contests was:

        1. Logic
        2. Constructive Algorithm
        3. Greedy
        4. Logic/DP (both were applicable)
        5. Graph Theory/Bitmasks
        6. Strings/DP

        I prefer logical questions over coding-heavy questions, but I'll try to keep it in mind.

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

          Yeah. When I solved C, I pretty much thought of what lines you were trying to make the contest, so I was trying hard to find some DP solution for D, and it turned out to be simple logic based.

          @Ashishgup , anyway its good to see an Indian problem setter avoiding involvement of heavy DSA for E and F problems. Looking forward to solving some more great problems set by you :) Best of Luck for future contest! Its good to see that you took my comment in a positive spirit.

          @ushagal0000 A problem can also involve logical thinking with so "already invented" algorithms. Infact, if just knowing "already invented" algorithms could help solve all questions, then the majority of the world would be LGM. You always need a logical thinking even if the problem involves usage of "already invented" algorithm.

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

Nice tasks + nice pretests = super contest. Thanks)

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

I liked problem E.

But I feel that problems B, C, D need some luck. You need to make a guess on what can be the solution then to verify it or maybe just submit it.

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

    i spent some time try to proof that the B will always have a solution(for n>2 ), my roommate just submitted the solution immediately. both got AC :D

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

    I have actually verified my B. If you a take any divisor v of n(n+1)/2 such that 2 <= v <= sqrt(n(n+1)/2), you can create the two sets such that one of them contains this divisor and the other contains the rest of numbers. Because if v|a and v|b, therefore v|(a+b).

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

    In B I have a nice proof:

    The sum of all values is n*(n+1)/2, you want to find a single element that divides the sum and is equal or smaller than n. This number can be (n+1)/2 rounded down clearly.

    It is possible to prove D too (even thogh I failed systest for mistaking a variable haha)

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

    Superb contest. And I agree with this. Literally, when I was solving D. I found correct soln. Accounted for all corner case. And was just praying to get AC. At last, I got it. Although for B,C I made some proof. And then submitted. For all questions, I found correct soln. Then waited for 3-4 to 10-15 min. To verify it. And take care of corner test cases.
    Really enjoyed Solving Tasks. Thanks Ashishgup.
    Looking forward for the editorials.

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

It seems that tests for E might be incomplete (or I misunderstood something); consider this testcase:

6

1 10 1

1 2 2

2 10 3

2 20 3

3 1 4

4 10 4

My solution, which passes tests, prints 52, but if I'm not wrong, the correct answer should be 43, like this:

[1|10|1] [1|2|2] [2|20|3] [3|1|4] [4|10|4]

Ashishgup, please take a look at this.

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

300iq cdkrot please delete my one of the exactly same codes submitted during the contest for problem C .

https://mirror.codeforces.com/contest/1038/submission/42577005 and https://mirror.codeforces.com/contest/1038/submission/42576866

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

Strong pretests? Wow, it darn good

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

An Enjoyable Contest by an Indian Ashishgup. I am Happy to be back in track after many bad days

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

rating changes !!

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

Hi, Are long and long long not same in codeforces GNU G++17 7.3.0 compiler?

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

Ну почему пересчёт рейтинга снова такой долгий?!

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

Thanks for the great contest)

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

Can anyone explain how to solve D with a proof? thanks in advance ....

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

    First of all, notice that the maximum value that you may get is sum(abs(a[i])) for 1<=i<=n. If the array consists of a combination of positive (>=0) and negative (<0) values, if you have v positive values, then v-1 of them can be subtracted from the negative values, and then subtract any negative value from the remaining positive value. By this, you get sum(abs(a[i]))

    If the array consists of only positive or only negative values, in this case, notice that if you subtracted any value from the other (v1-v2), min(abs(v1), abs(v2)) is better to be v1. For example, if the two values are (where all values are positive) 5,3; 5-3=2, but 3-5=-2. The difference here is that -2 can be used with the rest of positive values to get sum(abs(aa[i])) (assume aa is a after removing 3,5 and inserting -2). Also abs(v1) needs to be as minimum as possible, because in the subtraction process, abs(v1) is lost twice from sum(abs(a[i])) (in 3-5=-2, abs(3)+abs(5)-abs(2)=6=2*3). So the answer is sum(abs(a[i]))-2*min(abs(a[i])).

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

Thank you for a very nice contest

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

It seems that the test data for E is weak.

Some contestants just sum up all weights in a connected component, then check whether there are four odd vertices, and if so, subtract the minimum weight of a non-loop edge. Such solution could survive System Test. However, this is incorrect, for the graph may be unconnected after that edge removed.

Anyway, this is not a very common situation in Codeforces! lol

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

    I am sorry for the weak test data. We tried to add cases of every type and also some manual cases, but failed to break a few incorrect submissions (due to different heuristics being used by different participants). One case was added after system test, and if you think that incorrect solutions still get AC and you have any breaking case/code link, do tell. We will add the case to practice for further submissions. (We cannot rejudge the contest codes)

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

Can someone check the code for me?

http://mirror.codeforces.com/contest/1038/submission/42591350

Getting an error in Problem C in test case 58

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

I noticed that winner (Eccentricity) has cheated, you can totally understand that these two code written by two different people :

A 42559251 B 42560979 C 42566710 D 42573485 E 42575080 F 42582709

In A B C D he used spaces in for and +=1 instead of ++ but in problem E he used ++ and without spaces.

And if you look defines A-B-C-D have , but E-F have not... suddenly he use N define instead of maxn