Codeforces Round 390 (Div. 2)
A
Lesha and array splitting
Codeforces
1200
原题
←B →
翻译中…

One spring day on his way to university Lesha found an array $*A*$. Lesha likes to split arrays into several parts. This time Lesha decided to split the array $*A*$ into several, possibly one, new arrays so that the sum of elements in each of the new arrays is not zero. One more condition is that if we place the new arrays one after another they will form the old array $*A*$.

翻译中…

Lesha is tired now so he asked you to split the array. Help Lesha!

翻译中…

Input

翻译中…

The first line contains single integer $*n*$ ($1 ≤ *n* ≤ 100$) — the number of elements in the array $*A*$.

翻译中…

The next line contains $*n*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ ($- 10^{3} ≤ *a*_{*i*} ≤ 10^{3}$) — the elements of the array $*A*$.

翻译中…

Output

翻译中…

If it is not possible to split the array $*A*$ and satisfy all the constraints, print single line containing "NO" (without quotes).

翻译中…

Otherwise in the first line print "YES" (without quotes). In the next line print single integer $*k*$ — the number of new arrays. In each of the next $*k*$ lines print two integers $*l*_{*i*}$ and $*r*_{*i*}$ which denote the subarray $*A*[*l*_{*i*}... *r*_{*i*}]$ of the initial array $*A*$ being the $*i*$-th new array. Integers $*l*_{*i*}$, $*r*_{*i*}$ should satisfy the following conditions:

翻译中…
  • $*l*_{1} = 1$
  • $*r*_{*k*} = *n*$
  • $*r*_{*i*} + 1 = *l*_{*i* + 1}$ for each $1 ≤ *i* < *k*$.
翻译中…

If there are multiple answers, print any of them.

翻译中…

样例

Input #1
3
1 2 -3
Output #1
YES
2
1 2
3 3
InputCopy OutputCopy
Input #2
8
9 -12 3 4 -4 -10 7 3
Output #2
YES
2
1 2
3 8
InputCopy OutputCopy
Input #3
1
0
Output #3
NO
InputCopy OutputCopy
Input #4
4
1 2 3 -5
Output #4
YES
4
1 1
2 2
3 3
4 4
InputCopy OutputCopy
题目信息
题号
754A
时间限制
2 s
内存限制
256 MB
标签
构造
贪心
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。