跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F2098. k-d-sequence

  • ID: 2104
  • 传统题
  • 2000ms
  • 256MiB
  • 尝试: 0
  • AC · 已通过: 0
  • 教学难度:挑战
  • 上传者:
  • 数据结构
  • 挑战
  • 难度
  • 共享题库
  • Codeforces
  • 英文题面
  • 题目来源
  • 题面语言

k-d-sequence

题目描述

E. k-d-sequence
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

We'll call a sequence of integers a good k-d sequence if we can add to it at most k numbers in such a way that after the sorting the sequence will be an arithmetic progression with difference d.

You got hold of some sequence a, consisting of n integers. Your task is to find its longest contiguous subsegment, such that it is a good k-d sequence.

Input

The first line contains three space-separated integers n,k,d (1≤n≤2·105;0≤k≤2·105;0≤d≤109). The second line contains n space-separated integers: a1,a2,...,an (-109≤ai≤109)− the actual sequence.

Output

Print two space-separated integers l,r (1≤l≤r≤n) show that sequence al,al+1,...,ar is the longest subsegment that is a good k-d sequence.

If there are multiple optimal answers, print the one with the minimum value of l.

Examples
Input
6 1 2
4 3 2 8 6 2
Output
3 5
Note

In the first test sample the answer is the subsegment consisting of numbers 2, 8, 6− after adding number 4 and sorting it becomes sequence 2, 4, 6, 8− the arithmetic progression with difference 2.


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 1694 题。保留原作者与原赛事署名。