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

Автор orloffm, история, 2 года назад, По-русски

I can't figure out a way to unblock 1713D - Отсчет турнира. I used some wrappers over Console for easier testing, but even with pure Console usage it gets stuck on test 3: 167411234.

I do:

Console.WriteLine("? 1 2");
Console.Out.Flush();

And perform all reads by Console.ReadLine() only.

What can be the reason for this?

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

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

From statement:
After printing a query or the answer do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded.

From AskCompare:

Console.WriteLine("? {x} {y}"); // without dollar sign, because I don't know how to print it correct within code snipper
Console.Out.Flush();

Correct :)

From Solve:

if (a.Count == 2)
{
    var best = AskPick(a[0], a[1]);
    Console.WriteLine("! {best}");
    return;
}

Incorrect :(

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

    Yes, I fixed that, but it didn't help.

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

      1) Maybe you just have incorrect solution? Try check whether you read -1 (as described in statement)
      2) I'd try to generate minumum example with straight Console.WriteLine()/Console.ReadLine() instead any strange helpers (In particular, sizeof(char) != sizeof(byte) in C#, so I don't sure that printing cast '\n' to byte or reading byte from string is correct in C#)