Uneven Sand

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 16M

Author:
Problem type

Having just landed in the desert Kira remembers that his Strike Gundam is not yet programmed for sand environments. He needs to determine the right amount of pressure N that the Strike needs to exert on the sand so that it will neither sink nor float. In other words, he needs the pressure to be an exact number. He knows that the maximum pressure that needs to be exerted is 2 \times 10^9 and the minimum pressure is 1. He wants to find this number N in at most 31 guesses.

Interaction

This is an interactive problem. Your program will keep outputting numbers between 1 and 2 \times 10^9 inclusive and reading a line of input after each output. The line your program reads will be FLOATS if your guess for the pressure is too high, SINKS if your guess for the pressure is too low, and OK if you have the right number. At this point, your program should terminate.

Each time you output a number, you need to output a new line and flush your output buffers. For example, in Python you can do this with import sys; sys.stdout.flush(), and in Java with System.out.flush().

Sample Interaction

>>> denotes your output; don't actually print this out.

>>> 1
SINKS
>>> 6
SINKS
>>> 10
SINKS
>>> 40
FLOATS
>>> 32
OK

Comments


  • 0
    MioSenpai  commented on Oct. 20, 2018, 11:58 p.m.

    Shinn > Kira


  • 0
    anasschoukri2  commented on Sept. 17, 2017, 3:04 p.m. edited

    update : it s ok hehe :p


  • -3
    Itachi  commented on July 11, 2016, 1:49 p.m.
    AC submission now IR

    I resubmitted this and got this. I'm assuming that this is a problem with Turing?


    • 4
      quantum  commented on July 12, 2016, 1:14 p.m.

      You will notice that (most) interactive problems are impossible to solve at this time, since they were not updated after we rewrote a major part of the judge.


      • 0
        Kirito  commented on March 31, 2017, 12:21 p.m.

        Judge is now fixed; all submissions have been rejudged.


  • -1
    msa789  commented on Dec. 30, 2014, 9:56 p.m.
    how is this possible?

    im getting AC for all of the cases and all the times are all within the limit. How am I still not getting points for 2 of the cases?


    • 1
      FatalEagle  commented on Dec. 30, 2014, 10:28 p.m.

      You are exceeding the 31 guess limit. I fixed the grader to output WA when this happens. All submissions have been rejudged.


    • -1
      awaykened  commented on Dec. 30, 2014, 10:22 p.m.

      ((correct me if i'm wrong)) I think something is buggy with the system :x. nonetheless, the score for your program is correct, and your program fails test cases 1 and 5


  • -1
    Yuting9  commented on Dec. 30, 2014, 8:44 p.m.
    wat

    Even -snip- on C++ isn't fast enough... Am I doing something wrong?


    • 0
      BMP  commented on Dec. 30, 2014, 9:25 p.m.

      cout.flush();


    • 4
      FatalEagle  commented on Dec. 30, 2014, 8:52 p.m.

      Do not post solutions in the comments.

      Your C++ solution is not flushing stdout.

      This may be of interest to you.

      http://lmgtfy.com/?q=How+to+flush+stdout+C%2B%2B


      • -2
        Yuting9  commented on Dec. 31, 2014, 4:04 p.m.

        sorry about that...

        Thanks for the link, though :P