Code Submission Evaluation System Login

CSES - HIIT Open 2017

HIIT Open 2017

Contest start:2017-05-27 11:00:00
Contest end:2017-05-27 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard


Time limit:1.00 s
Memory limit:512 MB

There were $n$ coders from Aalto and $n$ coders from UH in a programming contest. It turned out that after the contest, each coder had a distinct score.

Your task is to find the $k$th highest score in the contest.


This is a special task: you are not directly given the scores of the coders, but you can only ask a set of queries.

Your program should interact with the grader using standard input and output. Initially, the grader gives you the values of $n$ and $k$. After this, you may perform a set of queries. There are three types of queries: You are allowed to perform at most $100$ queries, and your program must terminate after performing a query of type $3$.


In some languages, you may need to flush the output after printing a line. Do not use efficient I/O methods.


Assume that $n=3$, $k=1$ and the scores for Aalto are $[9,4,3]$ and the scores for UH are $[8,6,1]$. Here is an example of a valid interaction: