Guess the Sequence

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

There is a sequence of numbers of length N (1 \le N \le 15), with each number being either 1, 2, or 3. Can you guess this sequence?


This is an interactive problem. You should keep outputting numbers between 1 and 3, inclusive and reading a line of input after each output. The line will be NO if your guess for the current position is incorrect or YES if you guessed the current position correctly. If you guessed the whole sequence correctly, you will receive a single line DONE, and you should terminate your program then.

After each time you output a number, you might need to flush the output. In Python, you can do this with sys.stdout.flush() (after you import sys).

Sample Interaction

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

>>> 1
>>> 3
>>> 2
>>> 1
>>> 2
>>> 3


The sequence is 1, 2, 3.


There is only one input file, and the length of the sequence N is exactly 15. Your score will decrease with more wrong guesses, so guess as wisely as you can given that you have no information whatsoever about the secret sequence (or... do you?).


  • 0
    Alb11747  commented on July 21, 2020, 4:05 p.m.

    Can someone give another hint for this question?

    • 3
      RyanLi  commented on July 21, 2020, 6:11 p.m.

      Take a closer look at the problem ID

  • -2
    magicalsoup  commented on June 14, 2018, 8:23 p.m.

    wait, but my solutions should work right?, its 15 * 3 = 45, should easily run in time, why does it give me tle?

    • -1
      account_has_been_deactivated  commented on June 15, 2018, 11:02 a.m.

      You TLE because you never read the "NO" or "YES" that comes right after your output. The "DONE" always comes after a "YES", so your program never terminates.

    • 0
      injust  commented on June 14, 2018, 9:15 p.m.

      Try flushing your output

  • -1
    JollyJuniperus  commented on April 15, 2018, 1:39 a.m.

    Silly me. I should learn to read the English language :). It is solvable! Nice problem.

  • -1
    Lucifer  commented on July 17, 2017, 4:11 p.m.

    I'm having a hard time understanding the question. I thought it was asking me to create a "game" where the user inputs a number and if the user guesses the right number, it moves on to the next line.

    Perhaps I'm failing the time limit or my understanding of the question is way off.

    • 1
      Pleedoh  commented on July 17, 2017, 7:26 p.m.

      It's kind of a riddle question.

  • -1
    Kirito  commented on March 31, 2017, 2:37 p.m.

    Judge is now fixed; all submissions have been rejudged.

  • -6
    BMP  commented on Dec. 17, 2014, 4:59 p.m.

    This comment is hidden due to too much negative feedback. Click here to view it.

  • 1
    FatalEagle  commented on Nov. 28, 2014, 12:20 a.m.

    Do not submit infinite loops or programs in Java that do not flush for this problem. If you're not sure, you're better off not submitting until we fix this issue.

    • 0
      Xyene  commented on Dec. 17, 2014, 5:09 p.m.

      The issue has been resolved.

  • 0
    Zhenpai  commented on Oct. 2, 2014, 11:58 p.m.

    I get the feeling that this problem is somehow related to Maplestory...

    • 0
      bobhob314  commented on Dec. 5, 2014, 10:07 a.m.

      Yeah, Ludibrum Party Quest x)

      • -1
        bobhob314  commented on Dec. 15, 2014, 9:28 a.m.

        All those years of Maple ended up paying off x)

        jk, scrub me never got to Ludi. I googled a walkthrough forum. x)