CF1500A.Going Home
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
It was the third month of remote learning, Nastya got sick of staying at dormitory, so she decided to return to her hometown. In order to make her trip more entertaining, one of Nastya's friend presented her an integer array a.
Several hours after starting her journey home Nastya remembered about the present. To entertain herself she decided to check, are there four different indices x,y,z,w such that ax+ay=az+aw.
Her train has already arrived the destination, but she still hasn't found the answer. Can you help her unravel the mystery?
这是远程学习的第三个月,娜斯佳厌倦了待在宿舍,于是决定返回家乡。为了使旅途更加有趣,娜斯佳的一位朋友送给她一个整数数组 a。
出发回家几个小时后,娜斯佳想起了这份礼物。为了自娱自乐,她决定验证:是否存在四个互不相同的下标 x,y,z,w,使得 ax+ay=az+aw。
她的火车已经抵达目的地,但她仍未找到答案。你能帮她解开这个谜题吗?
输入格式
The first line contains the single integer n (4≤n≤200000) — the size of the array.
The second line contains n integers a1,a2,…,an (1≤ai≤2.5⋅106).
第一行包含一个整数 n(4≤n≤200000)—— 表示数组的大小。
第二行包含 n 个整数 a1,a2,…,an(1≤ai≤2.5⋅106)。
输出格式
Print "YES" if there are such four indices, and "NO" otherwise.
If such indices exist, print these indices x, y, z and w (1≤x,y,z,w≤n).
If there are multiple answers, print any of them.
如果存在这样的四个下标,则输出 "YES",否则输出 "NO"。
如果存在这样的下标,则输出这四个下标 x、y、z 和 w(1≤x,y,z,w≤n)。
如果存在多组答案,输出任意一组即可。
输入输出样例
输入#1
6 2 1 5 2 7 4
输出#1
YES 2 3 1 6
输入#2
5 1 3 1 9 20
输出#2
NO
说明/提示
In the first example a2+a3=1+5=2+4=a1+a6. Note that there are other answer, for example, 2 3 4 6.
In the second example, we can't choose four indices. The answer 1 2 2 3 is wrong, because indices should be different, despite that a1+a2=1+3=3+1=a2+a3
在第一个例子中,a2+a3=1+5=2+4=a1+a6。注意,还有其他答案,例如 2 3 4 6。
在第二个例子中,我们无法选出四个下标。答案 1 2 2 3 是错误的,因为下标必须互不相同,尽管 a1+a2=1+3=3+1=a2+a3。
输入解题思路,AI测评打分。不知道怎么写?