innocentkitten's blog

By innocentkitten, 6 hours ago, In English

Hope you enjoyed the problems!

UPD 1: Added implementations!

UPD 2: It seems my wording for the solution to C is not the best, and it is causing some confusion. I've updated it to be better!

UPD 3: Implementation links didn't work for some reason, so I've just added the code directly.

2055A - Two Frogs

Hint 1
Solution
Implementation

2055B - Crafting

Hint 1
Solution
Implementation

2055C - The Trail

Hint 1
Hint 2
Hint 3
Solution
Implementation

2055D - Scarecrow

Hint 1
Hint 2
Hint 3
Hint 4
Hint 5
Solution
Implementation

2055E - Haystacks

Hint 1
Hint 2
Hint 3
Hint 4
Solution
Implementation

2055F - Cosmic Divide

Hint 1
Hint 2
Hint 3
Hint 4
Hint 5
Solution
Implementation
  • Vote: I like it
  • +54
  • Vote: I do not like it

»
5 hours ago, # |
  Vote: I like it +22 Vote: I do not like it

fast editorial...orz

»
5 hours ago, # |
  Vote: I like it +12 Vote: I do not like it

woah that was fast! we've been getting lots of quick editorials lately, nice!

»
5 hours ago, # |
  Vote: I like it -12 Vote: I do not like it

c was cool

»
5 hours ago, # |
  Vote: I like it -11 Vote: I do not like it

tell me I'm not the one who use lazy segtree on B

»
5 hours ago, # |
  Vote: I like it +3 Vote: I do not like it

oh wow, thank you for fast editorial

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

What in the Itachi Crow Montage D problem :}

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I spent lot of time to figure out C, but then was about to give up without any idea, but then I tried to make a submission by making sum of rows and column Zero, and it worked .. I am not proud. But I hope to get some idea from the editorial.

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Oh yeah, I was also thinking along the same lines. But without any proof I did not try it further.

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Why zero? I got the case when n=m (a square) but my code didn't work for rectangles, perhaps because I assumed x. Does x=0 work throughout?

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    ok I think Sum = 0 works because n*S = m*S ... does that mean when n!=m ... there is no other possible value of S .. actually I was trying to find that value but didn't get any ideas

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I never thought that Problem D is a Greedy!

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone please tell me why my submission 300745220 for Problem D is failing?

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    The logic seems correct, but the error may be with the way you print the answer. Your val is long double, so when it becomes large enough, it prints in scientific notation, e.g. 4e+08 instead of 400000000

    Converting to long long should fix that: cout << 2 * (ll)val << endl;

    And generally, as a rule of thumb, if the answer to the problem is an integer, but your variable is a floating point, better always cast it to the int before printing, just in case :)

»
5 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

Use binary search, problem C is possible. Really inspiring problem C, I hardly solved it in 90mins.

I feel upset that I didn't solve it like editorials. I should practice more.

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    its completely normal to have a solution that isnt like the editorials.

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I tried to use binary search for C as well here: https://mirror.codeforces.com/contest/2055/submission/300745300

    But I still don't know why it doesn't pass, because from my analysis, my program would eventually search the case where $$$S=0$$$.

    • »
      »
      »
      5 hours ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      The difference between the last row and last col can be positive or negative. You should check if it is positive, then let $$$r = mid - 1$$$, or it will get wrong.

      • »
        »
        »
        »
        5 hours ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        That's what I tried to do. In my code, one of the sums (either row or col) will be equal to $$$S$$$, depending on whether the last instruction was D or R, so when I check whether one of the sums is larger than $$$S$$$, I'm essentially checking whether the difference is positive. I must be missing something here I guess but I still can't really see where in my program is wrong.

        • »
          »
          »
          »
          »
          5 hours ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          It makes sense. What would happen if you break when the difference equals 0?

»
5 hours ago, # |
  Vote: I like it +7 Vote: I do not like it

C was, brutal not gonna lie!

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    agreed, i had a similar approach to the editorial but i got overwhelmed with the 120 lines of code that i wrote and couldn't debug it in the last 10 mins.

    still, getting this close to solving C being rated 800 feels nice!

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

That's literally what I was trying to do for B and it didn't pass :-| My approach was to create a new array c that's a — b. If there are more than 1 negatives in c (we need to make more than 2 materials) the answer is NO.

Otherwise take the minimum positive in c and check whether it's large enough to turn the negative into 0.

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    your approach is correct though, i had the exact same approach and it passed. could you share your code?

    • »
      »
      »
      5 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      https://mirror.codeforces.com/contest/2055/submission/300708247

      Probably missed something important, will check it out again tomorrow. Thanks for confirming the approach is correct though, I was so confused. lol

      • »
        »
        »
        »
        5 hours ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        there's an edge case missing in your code, you didn't consider the possibility that all the numbers in the array c could be positive.

        when the code runs for such an array c, the variable negative_count equals zero and not 1, and thus your function returns false.

        just change the statement if (negative_count != 1) to if (negative_count > 1) and it'd work.

      • »
        »
        »
        »
        4 hours ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        In addition to what was written above, seems like you're not checking indexes, where a[i] == a[b], and therefore your min_positive is not equal to zero, when it should be

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Damn! Only solved A and B, and was stopped by C lol. Couldn't figure it out for the life of me.

»
5 hours ago, # |
Rev. 2   Vote: I like it +5 Vote: I do not like it

even tho i didnt do well this has to be the highest quality div 2 in a very long time

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    personally i didn't get to d and onward in time but i'd say the difficulty had a very sudden jump on c,yet the solution to it is very basic it's weird

    • »
      »
      »
      5 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I didnt think I could solve D during the contest is D hard for average pupil.I think C was easy for div2c (SO MANY PEOPLE USED GPT UNFORTUNATELY

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    but the balancing was horrendus ,no one ,i mean no one solve E or F

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

E and F so hard.

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

man if i didnt get WA due to using int not ll I would rank 1000 places higher

  • »
    »
    2 hours ago, # ^ |
      Vote: I like it -11 Vote: I do not like it

    made the exact same error, i used claude to fix it

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Aren't there any code that I can read so I can understand better??

»
5 hours ago, # |
  Vote: I like it +8 Vote: I do not like it

questions were good ngl , although i dont know how to even start D

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Problem C is really amazing.

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone point out the mistake in my submission for D 300739742. Looking at the editorial feels like my approach is similiar.

»
5 hours ago, # |
  Vote: I like it -18 Vote: I do not like it

why this failing for c

// this is code
void solve(){
    ll n,m;cin>>n;cin>>m;
    string s;cin>>s;
    vector<vector<ll> > v(n,vector<ll>(m,-1));
    rep(i,n){
        rep(j,m) cin>>v[i][j];
    }
    
    vector<vector<int> > vis(n,vector<int>(m,1));
    int i1=0;
    int j1=0;
    int x=0;
    vis[i1][j1]=-1;
    while(x<s.length()){
        if (s[x]=='D'){
            i1++;
            vis[i1][j1]=-1;
            x++;
        }
        else{
            j1++;
            vis[i1][j1]=-1;
            x++;
        }

    }

    // rep(i,n){
    //     rep(j,m) cout<<vis[i][j]<<" ";
    //     cout<<el;
    // }
    
    for (int i=0;i<n;i++){
        ll sum=0;
        ll mi=0;
        ll indx=-1;
       
        for (int j=0;j<m;j++){
            
            if (vis[i][j]==-1){
                indx=j;
                mi++;
            }
            else{
                sum=sum+v[i][j];
            }
        }
        if (mi==1){
            
            v[i][indx]=sum*-1;
            vis[i][indx]=1;
        }
    }

    for (int j=0;j<m;j++){
        ll sum=0;
        ll mi=0;
        ll indx=-1;
       
        for (int i=0;i<n;i++){
            
            if (vis[i][j]==-1){
                indx=i;
                mi++;
            }
            else{
                sum=sum+v[i][j];
            }
        }
        if (mi==1){
            
            v[indx][j]=sum*-1;
            vis[indx][j]=1;
        }
    }


    for (int i=0;i<n;i++){
        ll sum=0;
        ll mi=0;
        ll indx=-1;
       
        for (int j=0;j<m;j++){
            
            if (vis[i][j]==-1){
                indx=j;
                mi++;
            }
            else{
                sum=sum+v[i][j];
            }
        }
        if (mi==1){
            
            v[i][indx]=sum*-1;
            vis[i][indx]=1;
        }
    }

    for (int j=0;j<m;j++){
        ll sum=0;
        ll mi=0;
        ll indx=-1;
       
        for (int i=0;i<n;i++){
            
            if (vis[i][j]==-1){
                indx=i;
                mi++;
            }
            else{
                sum=sum+v[i][j];
            }
        }
        if (mi==1){
            
            v[indx][j]=sum*-1;
            vis[indx][j]=1;
        }
    }


    rep(i,n){
        rep(j,m) cout<<v[i][j]<<" ";
        cout<<el;
    }
}
  • »
    »
    5 hours ago, # ^ |
    Rev. 4   Vote: I like it 0 Vote: I do not like it

    Please use spoiler...

    you can use spoiler like this.

    1) <spoliler>

    2) then three backticks (```)

    3) Then your code.

    4) again three backticks (```)

    5) </ spoiler> ( remove space between / and the spoiler ).

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone please explain me why my submission 300732331 for Problem C is failing? I thought the way i coded that was the same thing that what written on the solution but i guess there's something i don't understand.

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    the added value can be long long, which will overflow if you set number type as int, I guess ?

»
5 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

F seems pretty out of place for a Div 2 contest — seems almost at the difficulty level of Div 1E.

The rest of the problems were pretty good. Well done!

»
5 hours ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

sorry i misread the turorial and made a dum comment

»
5 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

why in c we have to make sum ==0 of all rows and cols .... why can't we make sum of all rows and col equal max of sum of rows or col or anyother number

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Because s = 0 is the only possible solution for s*rows == s*cols when rows != cols.

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yeah same question, did someone make any other sum apart from zero.

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i got the answer let x be the sum of rows then sum of matrix = nx = mx

»
5 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Considering the difficulty of all the problems, I sincerely wish, if the contest had 2:15 minutes or 2:30 minutes.

I think, I solved D ( passing pretest 1 xD ), right after 5 minutes of contest ending :( .

Code for D, May or May not work.

I don't know, if anyone else solved D, within 10 minutes after the contest.

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

For the problem C, what is the intuition behind trying to make the sums of all rows and columns as 0. In the editorial it is written S.N has to be equal to S.M

But in the problem statement the only requirement is that we need to make sums of all individual rows and column same, am I missing something?

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    so (sum of each row == sum of each column) ..if that sum is 'S', so the total sum of GRID is S * n ... and also S * m .. so they should be equal

    but because n and m can be unequal ... S=0 is a solution to S*n = S*m

    • »
      »
      »
      4 hours ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      I didn't realise S.n and S.m means the total grid sum. It makes sense. Thank you!

  • »
    »
    5 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    sum of all rows=sum of grid and sum of all columns=sum of grid. so sum of all rows x.N=x.M sum of all columns

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Thanks For the Questions and also providing Solutions.. ! A nice event/contest : )

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Solved C before B. I should really think before implementing

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I got TLE in problem c. If someone finds the problem please let me know. My solution:- https://mirror.codeforces.com/contest/2055/submission/300745877

  • »
    »
    5 hours ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    I am not really sure, but can it be because of using slow input method Scanner or slow output ?

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Damn I misread B and couldn’t solve it but solved C. Now that I see it, I feel so damn dumb. B would be hard ig if in one operation the material increased by (n-1) rather than only 1 and the rest of the procedure remained the same. I wonder how it would play out then.

»
5 hours ago, # |
  Vote: I like it +2 Vote: I do not like it

feeling happy after climbing mountains of problem C

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Guys, will i reach specialist today?

»
5 hours ago, # |
  Vote: I like it +13 Vote: I do not like it

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

orz. amazing!!

»
5 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

i submitted 2 correct submissions for problem D(300739717 and 300743089), and 300743089 is just 300739717 with some ints turned into longs. I submitted 300743089 since I was scared that someone might be able to hack it to cause overflow. However, my first submission, 300739717 got skipped because it was almost identical to 300743089, but my second submission 300743089 didn't. Now, I have to incur the extra penalty for the second submission, since i submitted it 8 minutes later than the first. Does codeforces usually do this or should I get the points off of my first submission?

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    Whenever you have multiple submissions that pass pretests, all but the last are skipped. You could have completely rewritten the code without a hint of similarity between the two submissions, and 300739717 would have still been skipped and ignored.

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

for B someone help me in finding the case where this code fails 300733265

  • »
    »
    20 minutes ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Edit : You can ignore the text below editorial says the same You're taking every negative value into consideration, ig that's the issue

    If there is more than one negative value i,e a[i]-b[i]<0 then the answer will be no as we can never increase more than one value

    Example: a = 1 1 7 6 b = 2 2 3 3

    for i==0

    a = 2 0 6 5 b = 2 2 3 3

    for i==1

    a = 0 2 5 4 b = 2 2 3 3

    and if we keep doing a will perish out after few steps

    and now as we know there can only be one -ve value check if subtracting this negative value from any other element from the vector a doesn't give value less then the corresponding value of vector b.

    ==> if you want to know what will happen in next steps

    3. a = 2 0 3 2 b = 2 2 3 3

    4. a = 0 2 2 1 b = 2 2 3 3

    5.

    for the last index we can't give value from a[0] as subtracting 2 from 0 => -2 which is not possible in this case

    Can check my solution for the same

    If anybody think this is wrong please correct me :)

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Could someone maybe help me with [300707536]? I think I got the logic right but I cant explain why this is failing. Thanks!

(https://mirror.codeforces.com/contest/2055/submission/300707536)

»
4 hours ago, # |
  Vote: I like it +3 Vote: I do not like it

thank you innocentkitten for the wonderful contest and letting catgirl reach master orz

»
4 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Can someone please explain the maths behind C? My observation:

There exists $$$n + m$$$ variables: $$$n + m − 1$$$ values from cells, and the sum $$$S$$$.

There exists $$$n + m$$$ equations: From each row and each column.

So there can be $$$0, 1$$$ or $$$\infty$$$ solutions. But the editorial choosing sum $$$S$$$ implies there are infinite solutions. What is the proof of this?

Update: Nevermind I understood it.

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

First three problems are awesome <3

»
4 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

cout << (long long)2*tim << endl; cost me an AC in D

It should have been cout << (long long)(2*tim) << endl;

Very Dumb of me obviously to write that , even very dumb of me to not recognise it in my 15 mins debugging.

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

What is the proof for x=0 working for all test cases? The editorial without the proof doesn't make much sense. Also, are there any other values of x that will work for cases where n==m?

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

c was good

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anyone help me with todays B 2055B - Crafting.

My thought was: 300755890 We cannot increase more than one element for sure, why? Because if we try to increase A and B then we will inc. A then we have to dec B by atleast 1 and to inc B by 2 now we have to dec A by 2.

My second observation was that as the inc is dependent on dec so I calulated the minimum decrease that we can do and the max increase that we have to do although it is the single element. Now if the max increase is greater than the min decrease that we can bear than the ans in simply no.

for rest of the cases we can do the task so the ans is yes.

Can anyone please help me where I went wrong ?

Am I too dumb to ask this shit ?

  • »
    »
    3 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    a[i]>b[i] should be a[i]>=b[i]

    • »
      »
      »
      3 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thank you!. Would you please suggest what should I do in order to get rid of this silly mistakes.

      I have tears in my eyes but I can't cry .

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

EF are way harder than it should be. I've never seen a *3000 div2E.

»
3 hours ago, # |
  Vote: I like it +4 Vote: I do not like it

Problem Haystacks is so cool, I love it <3

»
3 hours ago, # |
  Vote: I like it +5 Vote: I do not like it

innocentkitten the implementations are not visible, we "aren't allowed to view the requested page"

»
3 hours ago, # |
Rev. 5   Vote: I like it +4 Vote: I do not like it

For me, an easier way to reason about problem D is to think of two cases:

  1. The current scarecrow is to the right, in which case we:
    • bring it closer to the crow by "spending" the time accumulated so far;
    • bring the previous and current scarecrows closer to each other, by half the distance between the crow and the latter, updating the elapsed time as necessary;
    • move the crow forward by $$$k$$$ units plus the distance from the previous step.
  2. The current scarecrow is to the left, in which case we:
    • bring it closer to the crow by "spending" the time accumulated so far;
    • move the crow forward by $$$k$$$ units minus the distance from the previous step (which must be less than $$$k$$$).

At the end, if there remains any distance, the last scarecrow must move forward by that distance (adding to the elapsed time). The special case of the first scarecrow can be handled before the main loop. 300755131

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

WA 4 times and wasted almost 30 mins cause of '=' in problem B

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Trying to learn from every contest and seeking improvement to reach the level of Expert one day.

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I changed the code for being sum =0 then also it give wrong ans at case 5k in test case 2 .....can you say why....300746771

»
3 hours ago, # |
  Vote: I like it +3 Vote: I do not like it

I am really disappointed by how nowadays contests are formed, do guys from 1400-1800 have no oppurutunity to solve problems involving some Data structure or algo, I mean this level of greedy upto D, i mean we should give some advantage to guys who have read something extra over heavily intelligent guys who are gud at observing or greedy.

  • »
    »
    2 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    remember people complaining last week why segment tree was required for D. i guess there will always be people complaining about smth

    • »
      »
      »
      117 minutes ago, # ^ |
      Rev. 2   Vote: I like it +3 Vote: I do not like it

      I understand your point, but my complaint was very generic like not so intelligent guys like me wants to solve graphs or maybe any DS in C or D, maybe I will also not like Segment tree but that will not be a complaint from my side bcse I think segment tree for D is sometimes okay.

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

https://mirror.codeforces.com/contest/2055/submission/300760875

why Am I getting wrong answer here, please someone tell whats wrong, I did almost same thing as everyone did

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

In Problem C

Can it be proven that when n=m the solution x=0 is also possible?

»
2 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

I appreciate the detailed editorial with hints and everything... also, I enjoyed the contest! :D

»
2 hours ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

In C, why is it correct to assert S × n = S × m? Why does the sum of the sum of the rows need to be equal to that of the columns? Oh, I get it, it's just the sum of the grid

»
105 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

For problem D, is anyone able to help figure out a counter case for my submission where the answer should be 1 but I get 2? https://mirror.codeforces.com/contest/2055/submission/300762828. I'm failing on the 2727th test case somehow

»
93 minutes ago, # |
  Vote: I like it +1 Vote: I do not like it

Nice explanation for problem C, I just guessed that setting x = 0 will work but wasn't able to prove why.

»
90 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

Very high quality C and D, loved the round

»
78 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

what bothered me in this contest were the weak samples which caused me to get a lot of penalty. in A we'd pass the sample just checking whether they're adjacent. in B we'd pass the sample just checking the first material. at the end of the day it was just skill issue from my part, but still wish the samples were a bit more descriptive

»
66 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

For problem C: The fact that $$$S = 0$$$ will hold when $$$n = m$$$ is not trivial and the editorial's argument is not sufficient for that.

One argument for $$$m = n$$$ is that there are $$$n+m$$$ variables ($$$n+m-1$$$ on the path and $$$1$$$ which is $$$S$$$) but the $$$n+m$$$ linear equations are not linearly independent (since $$$m=n$$$, sum of all columns equal sum of all rows). So, we can pick $$$S$$$ to be anything we want since there are only $$$n+m-1$$$ linearly independent equations.

  • »
    »
    7 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Can you please explain what did you just said, I can't really wrap my head around this

»
26 minutes ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Hey does anyone know why 300769418 doesn't work?

»
11 minutes ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

For D, you can multiply l, k, and the entries of a by 2 (but keep the speed at 1), so that you don't need to work with doubles.

Also, the solution to D is well-written, thanks!