AT_scpc2026_div3_f.SQL

入门

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

As you know, SQL stands for "Sorohue is a Query Lover".

QQ queries are given.

  • xx: If x<0x < 0, print the input of the ∣x∣|x|–th query; if x>0x > 0, print the output of the ∣x∣|x|–th query. (1≤∣x∣≤Q1 \le |x| \le Q)

After all queries are given, answer all queries in order.

众所周知,SQL 代表“Sorohue 是一位 Query(查询)爱好者”。

共给出 QQ 个查询。

  • xx:若 x<0x < 0,输出第 ∣x∣|x| 个查询的输入;若 x>0x > 0,输出第 ∣x∣|x| 个查询的输出。(1≤∣x∣≤Q1 \le |x| \le Q)

在全部查询给出后,按顺序回答所有查询。

输入格式

The input is given from Standard Input in the following format:

QQ
x1x_1 x2x_2 …\dots xQx_Q

输入从标准输入中按以下格式给出:

QQ
x1x_1 x2x_2 …\dots xQx_Q

输出格式

Output QQ integers separated by a blank on a single line. The ii–th integer is the answer to the ii–th query.

The answer to each query must be an integer whose absolute value is between 11 and QQ, inclusive.

If there are multiple valid answers, output any one of them. There always exists a way to satisfy the conditions and correctly answer all queries.

在一行中输出 QQ 个整数,整数之间用空格分隔。第 ii 个整数为第 ii 个查询的答案。

每个查询的答案必须是一个绝对值在 11 到 QQ(含端点)之间的整数。

若存在多个合法答案,输出其中任意一个即可。总存在一种方式满足所有条件,并正确回答全部查询。

输入输出样例

  • 输入#1

    6
    -2 -3 -1 1 2 6

    输出#1

    -3 -1 -2 -3 -1 4

说明/提示

表示言語

/ /

Sample 1 Explanation:
Query 1 outputs -3, which is the input for Query 2, so it is correct.

Query 4 outputs -3, which is the answer to Query 1, so it is correct.

Query 6 outputs 4, which is the answer to Query 6, so it is correct.

Constraints

  • 1≤Q≤500 0001 \le Q \le 500\,000
  • 1≤∣xi∣≤Q1 \le |x_i| \le Q
  • All input values are integers.

表达式语言

/ /

样例 1 解释:
查询 1 输出 -3,该值作为查询 2 的输入,因此是正确的。

查询 4 输出 -3,该值是查询 1 的答案,因此是正确的。

查询 6 输出 4,该值是查询 6 的答案,因此是正确的。

约束条件

  • 1≤Q≤500 0001 \le Q \le 500\,000
  • 1≤∣xi∣≤Q1 \le |x_i| \le Q
  • 所有输入值均为整数。

输入解题思路,AI测评打分。不知道怎么写?

首页