AmanAgr2509's blog

By AmanAgr2509, history, 3 years ago, In English

1st: In yesterday's contest I got FST on B on T.C-11, and after I reviewed it I found out that I was mistakenly running loop till n where I should run it till n-1 only, but ironically pretests passed without RTE, so could anyone explain why RTE didn't occur...

2nd: As per the blog the comparator should return false, and as per my code, it would be returning false, but doing this showed WA on CSES Projects DP question and as I entered (>=) it got AC. So, what's the logic behind this flaw, or is it due to my false understanding.

Thanks for your help!

  • Vote: I like it
  • +2
  • Vote: I do not like it

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

im not sure what is happening in the first question and i can't really click the link for the "blog" in the second question

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

    I am sorry for that, could you please check again... Thank you!

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

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

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

1) You can in Custom Invocations run following code

#include<bits/stdc++.h>
using namespace std;

int main() {
    string s1[1] = { "abc" };
    string s2[1] = { "def" };
    map<char, int> m { { '1', 1 }, { '2', 2 } };
    cout << s2[1] << endl;
    return 0;
}

And see that it doesn't fail. Because s2[1] most likely lookup in memory used by map. That is still incorrect code and you were just "lucky" to not have RTE in pretests.

2) If you are insist that with definety incorrect comparator you get AC and with correct comparator you get WA then your logic in whole code must be wrong. But you not provide neither problem nor code, so this is just guess.

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

    Here's the link for the code of 2nd... And for 1st, I could say I was rather unlucky. :P Thanks a lot though.