B. Interesting Subarray
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

For an array max(a)−min(a)=7−0=7≥5.

You are given an array a, or tell that it doesn't exist.

An array a by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. In particular, an array is a subarray of itself.

Input

The first line contains integer number t test cases follow.

The first line of each test case contains a single integer 2≤n≤2⋅105) — the length of the array.

The second line of each test case contains 0≤ai≤109) — the elements of the array.

It is guaranteed that the sum of 2⋅105.

Output

For each test case, output "NO" in a separate line if there is no interesting nonempty subarray in a.

Otherwise, output "YES" in a separate line. In the next line, output two integers 1≤l≤r≤n) — bounds of the chosen subarray. If there are multiple answers, print any.

You can print each letter in any case (upper or lower).

Example
input
3
5
1 2 3 4 5
4
2 0 1 9
2
2019 2020
output
NO
YES
1 4
NO
Note

In the second test case of the example, one of the interesting subarrays is max(a)−min(a)=9−0=9≥4.

/*
    只要存在合法字串,那么一定存在长度为2的合法子串
*/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define maxn 200010
using namespace std;
int a[maxn],n;
int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        scanf("%d",&n);
        for(int i=1;i<=n;i++)scanf("%d",&a[i]);
        if(n==1){
            puts("NO");
            continue;
        }
        bool flag=0;
        for(int i=2;i<=n;i++){
            if(abs(a[i]-a[i-1])>=2){
                flag=1;
                puts("YES");
                printf("%d %d\n",i-1,i);
                break;
            }
        }
        if(!flag)puts("NO");
    }
    return 0;
} 

 

相关文章:

  • 2022-12-23
  • 2021-10-28
  • 2022-03-07
  • 2021-12-12
  • 2021-05-25
  • 2022-01-28
  • 2021-10-13
  • 2021-10-07
猜你喜欢
  • 2021-10-12
  • 2021-06-16
  • 2021-07-09
  • 2022-03-03
  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案