orloffm's blog

By orloffm, history, 2 years ago, translation, In English

I can't figure out a way to unblock 1713D - Tournament Countdown. 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?

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

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

      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#)