#include #define int long long using namespace std; #define fi first #define sc second #define pii pair #define pb push_back const int maxn=6e5+10; int n,k,a[maxn],s[maxn],nxt[maxn][20],f[maxn]; namespace Fast_IO { static char buf[1000000],*paa=buf,*pd=buf,out[10000000];int length=0; #define getchar() paa==pd&&(pd=(paa=buf)+fread(buf,1,1000000,stdin),paa==pd)?EOF:*paa++ inline int read() { int x(0),t(1);char fc(getchar()); while(!isdigit(fc)){if(fc=='-') t=-1;fc=getchar();} while(isdigit(fc)) x=(x<<1)+(x<<3)+(fc^48),fc=getchar(); return x*t; } inline void flush(){fwrite(out,1,length,stdout);length=0;} inline void put(char c){if(length==9999999) flush();out[length++]=c;} inline void put(string s){for(char c:s) put(c);} inline void print(int x) { if(x<0) put('-'),x=-x; if(x>9) print(x/10); put(x%10+'0'); } inline bool chk(char c) { return !(c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9'); } inline bool ck(char c) { return c!='\n'&&c!='\r'&&c!=-1&&c!=' '; } inline void rd(char s[],int&n) { s[++n]=getchar(); while(chk(s[n])) s[n]=getchar(); while(ck(s[n])) s[++n]=getchar(); n--; } } using namespace Fast_IO; bool chk(int x) { for(int i=1;i<=n*2;i++) { nxt[i][0]=lower_bound(s+1,s+n*2+1,s[i]+x)-s; } for(int i=0;i<=19;i++) nxt[n*2+1][i]=n*2+1; for(int i=1;i<=19;i++) { for(int j=1;j<=n*2;j++) nxt[j][i]=nxt[nxt[j][i-1]][i-1]; } for(int i=1;i<=n;i++) { nxt[n*2][0]=n*2; int now=i; for(int j=0;j<=19;j++) { if(k&(1<>n>>k; for(int i=1;i<=n;i++) cin>>a[i],a[i+n]=a[i]; for(int i=1;i<=n*2;i++) s[i]=s[i-1]+a[i]; int l=0,r=1e10,mid=0; while(l<=r) mid=(l+r)>>1,(chk(mid)?l=mid+1:r=mid-1); l--,cout<n); } // cout<>t; while(t--) solve(); return 0; }