AT_scpc2026_div3_f.SQL
入门
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
As you know, SQL stands for "Sorohue is a Query Lover".
Q queries are given.
- x: If x<0, print the input of the ∣x∣–th query; if x>0, print the output of the ∣x∣–th query. (1≤∣x∣≤Q)
After all queries are given, answer all queries in order.
众所周知,SQL 代表“Sorohue 是一位 Query(查询)爱好者”。
共给出 Q 个查询。
- x:若 x<0,输出第 ∣x∣ 个查询的输入;若 x>0,输出第 ∣x∣ 个查询的输出。(1≤∣x∣≤Q)
在全部查询给出后,按顺序回答所有查询。
输入格式
The input is given from Standard Input in the following format:
Q
x1 x2 … xQ
输入从标准输入中按以下格式给出:
Q
x1 x2 … xQ
输出格式
Output Q integers separated by a blank on a single line. The i–th integer is the answer to the i–th query.
The answer to each query must be an integer whose absolute value is between 1 and Q, 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.
在一行中输出 Q 个整数,整数之间用空格分隔。第 i 个整数为第 i 个查询的答案。
每个查询的答案必须是一个绝对值在 1 到 Q(含端点)之间的整数。
若存在多个合法答案,输出其中任意一个即可。总存在一种方式满足所有条件,并正确回答全部查询。
输入输出样例
输入#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≤500000
- 1≤∣xi∣≤Q
- All input values are integers.
表达式语言
/ /
样例 1 解释:
查询 1 输出 -3,该值作为查询 2 的输入,因此是正确的。
查询 4 输出 -3,该值是查询 1 的答案,因此是正确的。
查询 6 输出 4,该值是查询 6 的答案,因此是正确的。
约束条件
- 1≤Q≤500000
- 1≤∣xi∣≤Q
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?