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

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

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!

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

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

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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

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

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.