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

Автор meintoo, 10 лет назад, По-английски

hello everyone
today in C.F 295 div 2 I tried to hack Assassinboy'A problem . As per the question the output was to be "YES" and his output was "Yes" and there was nowhere mentioned that both are considered to be same . And it showed unsuccessful hacking attempt . My hack number is 140753 from C.F 295 div 2 and the user's solution id is 10111519 and it is also showing AC !!! Do help .
Thanks in advance

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

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

Hello, May be the checker is not bothering of case.i.e case insensitive. Before hacking you would have thought once that "It Passed Pretests. and there is a case of YES in pretests. so it's useless to hack". I guess you understood ?

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

    then wouldn't it be explicitly mentioned in the problem ??? and how can we sure of pretests !! Yes you are right but how can we say it for sure ??

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

      Pretests should also include sample tests given in the problem. And yes they would have mentioned about it in the problem but they didn't!

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

You are right, the grader doesn't work correctly. The submission should not have passed the pretests.

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

There is a default checker to compare contestant's solution output with the expected answer. Problem authors who request you to output some string use that checker most of the times (99% would be a good estimate). That checker does case insensitive comparison, so both "Yes" and "YES" are considered to be the same string. And I hope you agree that in this particular case it doesn't really matter whether solution outputs 'yes' or 'YES' or 'YeS', anyway you know whether the answer is 'yes' or 'no'. This is the case most of the times, we rarely need case sensitive comparison for answers. So by default authors used case insensitive checker and because that is default it is not mentioned in the problem statement. If you look up similar problems in the archive you will see that it's case insensitive there as well most of the times.

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

Many problem setters uses checker in Codeforces testlib. The "Yes or No" checker in it ignore the case of letter.

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

in the last contest when there was to print black white or draw 519A - A and B and Chess there was this check which made me hack the user's solution this time !!! All I am to say is this case insensitiveness if there is should be clearly mentioned in the problem statements !! as last time costed a W.A and this time a wrong hack both too of the opposite reasons
thanks for reading

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

    You should notice that the sample contained all of "Black", "White" and "Draw". So all solutions which can pass the pretest cannot be hacked only because of output formats, since all samples MUST be in pretests.

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

      Samples/pretests might help in this particular problem but it's not a complete solution. What would you do if not all of the possible outputs are covered in samples? Sometimes you might want to hack a solution which outputs strings mixed uppercase/lowercase characters but you will have no idea whether it will be counted as correct answer or not.

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

        Exactly the same !!! That's why , this case insensitiveness should be mentioned

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

    Hm, I don't know why authors put case sensitive checker in this problem, I agree that it's inconvenient not to know whether checker is case sensitive or not. I would think that for this particular problem set CF problem coordinator overlooked that authors selected case sensitive checker.

    That being said, I still think that it's ok to have case insensitive checker as default for this kind of outputs and do not mention it in the statement. If you think about it, output is not compared strictly as string vs string, there might be some differences in the expected and actual output and that's ok. For example most of the time some white space difference is allowed, you can output 1 2 where 1 2 is expected. You can output extra spaces before a new line, you can even break lines most of the times as you wish yourself and all of those will be considered correct by standard checker. You can never see it mentioned in the problem statement but it's just convenient for contestants to have such a liberal checker. The only problem seems to be that authors this time put more strict checker (I see no reason why).

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

Anyways , thanks a lot guys for your time !!! I believe such situations should be handled well in advance by the C.F guys not to create a misunderstanding like this !!!
Thanks for reading and afterall its great to be a part of C.F !! the guys are just awesome