CF359D Pair of Numbers

题目描述

Simon 有一个长度为 $ N $ 的正整数数列 $ a_1 , a_2 , \cdots , a_n $ ,现在他想找到这个数列中最长的一个区间,满足区间中有一个数可以整除区间中任意数。

输入格式

第一行有一个正整数 $N$ $(1 \leq N \leq 3 \times 10^5)$ ,表示数列的长度; 第二行有 $N$ 个正整数 $ a_1 , a_2 , \cdots , a_n $ $(1 \leq a_i \leq 10^6)$ ,即为给出的数列。

输出格式

第一行包含两个正整数,分别表示满足要求的最长区间的个数与长度。 第二行以升序输出排列所有满足要求的最长区间的左端点序号。 这里,区间的长度定义为**右端点减左端点**。

说明/提示

In the first sample the pair of numbers is right, as numbers $ 6,9,3 $ are divisible by $ 3 $ . In the second sample all numbers are divisible by number $ 1 $ . In the third sample all numbers are prime, so conditions $ 1 $ and $ 2 $ are true only for pairs of numbers $ (1,1) $ , $ (2,2) $ , $ (3,3) $ , $ (4,4) $ , $ (5,5) $ .