time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given a permutation p1,p2,…,pnp1,p2,…,pn. Recall that sequence of nn integers is called a permutation if it contains all integers from 11 to nn exactly once.

Find three indices ii, jj and kk such that:

  • 1≤i<j<k≤n1≤i<j<k≤n;
  • pi<pjpi<pj and pj>pkpj>pk.

Or say that there are no such indices.

Input

The first line contains a single integer TT (1≤T≤2001≤T≤200) — the number of test cases.

Next 2T2T lines contain test cases — two lines per test case. The first line of each test case contains the single integer nn (3≤n≤10003≤n≤1000) — the length of the permutation pp.

The second line contains nn integers p1,p2,…,pnp1,p2,…,pn (1≤pi≤n1≤pi≤n; pi≠pjpi≠pj if i≠ji≠j) — the permutation pp.

Output

For each test case:

  • if there are such indices ii, jj and kk, print YES (case insensitive) and the indices themselves;
  • if there are no such indices, print NO (case insensitive).

If there are multiple valid triples of indices, print any of them.

Example

input

Copy

3
4
2 1 4 3
6
4 6 1 2 5 3
5
5 3 1 2 4

output

Copy

YES
2 3 4
YES
3 5 6
NO

解题说明:水题,遍历数组查找满足条件的值即可。

#include<stdio.h>
#include<stdlib.h>int main()
{int t;scanf("%d", &t);while (t--){int n, a[1000], f = 0, i;scanf("%d", &n);for (i = 0; i<n; i++) {scanf("%d", &a[i]);}for (i = 1; i<n - 1; i++){if ((a[i] > a[i - 1]) && (a[i] > a[i + 1])){printf("YES\n");printf("%d %d %d\n", i, i + 1, i + 2);f = 1;break;}}if (f == 0) {printf("NO\n");}}return 0;
}

A. Three Indices相关推荐

  1. [pcl::VoxelGrid::applyFilter] Leaf size is too small for the input dataset. Integer indices would ov

    1. 报错日志: Python-pcl 点云下采样时报错如下: [pcl::VoxelGrid::applyFilter] Leaf size is too small for the input d ...

  2. python编程之slice与indices函数用法

    这篇文章主要介绍了详解python编程中slice与indices使用示例,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪 一般来说,内置的slice()函数会创建一个切片 ...

  3. IDEA 出现 updating indices 卡进度条问题的解决方案并加快索引速度

    IDEA 出现 updating indices 卡进度条问题的解决方案并加快索引速度 参考文章: (1)IDEA 出现 updating indices 卡进度条问题的解决方案并加快索引速度 (2) ...

  4. “TypeError: list indices must be integers or slices, not str”有关报错解决方案

    "TypeError: list indices must be integers or slices, not str"有关报错解决方案 参考文章: (1)"TypeE ...

  5. python3 错误string indices must be integers 的解决方法

    这个错误意思是字符串的下标一定要是整数 出这种错误有多种可能,最形象直接的就是: a = '[abc]' print(a['0']) 有点pyhton基础的都知道下标怎么能是字符串'0',必须是整数0 ...

  6. python indices,python – 什么“indices参数被弃用并将被删除(假设为True)0.17”是什么意思?...

    我刚开始学习python并道歉,如果这是一个非常基本的问题/错误. 我在做Kaggle生物反应教程.我收到了这个错误 C:\Anaconda\lib\site-packages\sklearn\cro ...

  7. too many indices for tensor of dimension 3

    too many indices for tensor of dimension 3 原因还未找到,只是感觉把维度换成一模一样就不报错了,或者换成另一片博文中的也可以. too many indice ...

  8. tensors used as indices must be long or byte tensors

    tensors used as indices must be long or byte tensors import torch import numpy as np a=torch.zeros(( ...

  9. list indices must be integers or slices, not tuple

    11年it研发经验,从一个会计转行为算法工程师,学过C#,c++,java,android,php,go,js,python,CNN神经网络,四千多篇博文,三千多篇原创,只为与你分享,共同成长,一起进 ...

  10. Tensorflow图像通道合并,IndexError: too many indices for array

    在读入多张图像并且在第3维上进行合并时(image[:, :, :]),出现IndexError: too many indices for array错误 data1 = imread('E:/da ...

最新文章

  1. 阿里巴巴领导抱怨家里有矿的应届生不好带!聪明效率高,但从不加班,也不做职业规划!画饼谈心也没用,怎么办?...
  2. 挂接CreateProcessW实现对进程创建的完全控制
  3. IPSEC ×××需要解决的路由问题及影响IPSEC ×××的网络问题
  4. 关于在 matlab 中使用 ode45 算出拉格朗日方程中的关节加速度
  5. 不要拿ERP的报表忽悠领导!——一个报表引发的企业经营反思
  6. 将提取出的yuv三个分量序列合并成一个完整的彩色yuv序列(matlab实现)
  7. JS高程5.引用类型(6)Array类型的位置方法,迭代方法,归并方法
  8. link和@import区别
  9. [SDK]新浪微博请求授权显示错误页面的解决方法
  10. 把一个base64编码的图片绘制到canvas (canvas的图片在转成dataurl)
  11. MapReduce强化实验
  12. 程序员养生书单,九本必读养生书籍,颈椎按摩,脊椎按摩,脱发植发
  13. ~ 运算符和 ~~ 运算符(JS)
  14. 防火墙(NGFW)与UTM本质上的区别
  15. 家用NAS安装大礼包:PVE+OMV+常用soft详细安装教程
  16. 单核性能强的服务器cpu,Cpu单核性能强和多核性能强都有什么用?
  17. python实现RGB转换HSV
  18. 华为鸿蒙战略发布会内容,万物互联!华为鸿蒙发布会带来无限可能
  19. qrious二维码生成插件
  20. Python科学计算库核心知识点总结_代码篇(ML/DL依赖语法)

热门文章

  1. 《C陷阱与缺陷》第三章
  2. 2017-10-22—光电二极管
  3. 有时候,也想过回到过去
  4. 用备忘录激发灵感创造力的方法
  5. python函数递归求和详解_Python3 递归函数
  6. NR随机接入之MSG3
  7. mac安装autojump
  8. PPS文件如何转换成PPT?附两种方法
  9. 苹果软件更新在哪里_今日更新:丨企业证书已更新丨苹果丨安卓软件下载说明丨...
  10. 快速修改mysql密码的四种方法