题库练习 Ithea Plays With Chtholly
← 上一题 下一题 →

A11395 | Ithea Plays With Chtholly

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

This is an interactive problem. Refer to the Interaction section below for better understanding.

Ithea and Chtholly want to play a game in order to determine who can use the kitchen tonight.

![](/uploads/acgo/image/48b0348e94a318bc_dc92af6dfa78.jpeg)

Initially, Ithea puts $n$ clear sheets of paper in a line. They are numbered from $1$ to $n$ from left to right.

This game will go on for $m$ rounds. In each round, Ithea will give Chtholly an integer between $1$ and $c$ , and Chtholly needs to choose one of the sheets to write down this number (if there is already a number before, she will erase the original one and replace it with the new one).

Chtholly wins if, at any time, all the sheets are filled with a number and the $n$ numbers are in non-decreasing order looking from left to right from sheet $1$ to sheet $n$ , and if after $m$ rounds she still doesn't win, she loses the game.

Chtholly really wants to win the game as she wants to cook something for Willem. But she doesn't know how to win the game. So Chtholly finds you, and your task is to write a program to receive numbers that Ithea gives Chtholly and help her make the decision on which sheet of paper write this number.

输入格式

The first line contains 3 integers $n,m$ and $c$ (![](/uploads/luogu/CF896B/6fe2bd15e021b147fb5005407a27f05417b03766_963dc1e2c5be.png), ![](/uploads/luogu/CF896B/c34b3ba4302b2b19ef11096468acf388bbd18e1a_dee636fdffd4.png) means ![](/uploads/acgo/image/d86aaebc3ac658be_d509bad7e10b.jpeg) rounded up) — the number of sheets, the number of rounds and the largest possible number Ithea can give to Chtholly respectively. The remaining parts of input are given throughout the interaction process.

输出格式

In each round, your program needs to read one line containing a single integer $p_{i}$ ( $1<=p_{i}<=c$ ), indicating the number given to Chtholly.

Your program should then output a line containing an integer between $1$ and $n$ , indicating the number of sheet to write down this number in.

After outputting each line, don't forget to flush the output. For example:

- fflush(stdout) in C/C++;
- System.out.flush() in Java;
- sys.stdout.flush() in Python;
- flush(output) in Pascal;
- See the documentation for other languages.

If Chtholly wins at the end of a round, no more input will become available and your program should terminate normally. It can be shown that under the constraints, it's always possible for Chtholly to win the game.

输入输出样例

输入 #1
2 4 4
2
1
3
输出 #1
1
2
2
C++ 编辑器
输入
输出