传送门

不知谁说过一句名句,我们要学会复杂度分析

 #include <bits/stdc++.h>
 using namespace std;
 #define rep(i,a,b) for(int i=a;i<=b;++i)
 #define fd(i,a,b) for(int i=a;i>=b;--i)
 ;
 typedef long long ll;
 inline ll gi() {
     ll x=; char o; bool f=true; for(;!isdigit(o=getchar());) if(o=='-')f=false;
     )+(x<<)+(o&); ;
 }
 ll ans,a[maxn],pre[maxn<<][];
 int n;
 ll gcd(ll x,ll y){return x?gcd(y%x,x):y;}
 ll gt(int s,int t) {
     ll ret=a[s];
     fd(i,,) <<i)-<=t)
         ret=gcd(ret,pre[s][i]),s=s+(<<i);
     return ret;
 }
 int Find(int l,int r,int s,ll v) {
     int ret=l;
     while( l<=r) {
         ;
         ;
         ;
     }
     return ret;
 }
 int main() {
 #ifndef ONLINE_JUDGE
     freopen("3.in","r",stdin);
 #endif
     scanf(,n) a[i]=pre[i][]=gi();
     rep(k,,) rep(i,,n)
         pre[i][k]=gcd(pre[i+(<<k-)][k-],pre[i][k-]);
     rep(i,,n) {
         int L=i;
         while(L<=n) {
             ll val=gt(i,L); int ed=Find(i,n,i,val);
             ans=max(ans,1LL*(ed-i+)*val); L=ed+;
         }
     }
     printf("%lld\n",ans);
     ;
 }