1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| #include<cstdio> #include<iostream> using namespace std; int n, a[366666],f[399999],p[399999],tot=0,max1=-8; int main(){ freopen("select.in","r",stdin); freopen("select.out","w",stdout); scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); for(int i=1;i<=n;i++) { int l=i-1,r=i+1; while(a[l]%a[i]==0&&a[l]>=a[i])l--; while(a[r]%a[i]==0&&a[r]>=a[i])r++; r--,l++; max1=max(max1,r-l+1); } for(int i=1;i<=n;i++) { int l=i-1,r=i+1; while(a[l]%a[i]==0&&a[l]>=a[i])l--; while(a[r]%a[i]==0&&a[r]>=a[i])r++; r--,l++; if(r-l+1==max1&&!f[l]) tot++,p[tot]=l,f[l]=1; } printf("%d %d\n",tot,max1); for(int i=1;i<=tot;i++) printf("%d ",p[i]); }
|