QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#357757 | #7737. Extending Distance | Nahidameow | AC ✓ | 813ms | 12304kb | C++20 | 17.7kb | 2024-03-19 10:44:50 | 2024-03-19 10:44:50 |
Judging History
answer
#include<bits/stdc++.h>
//=========================================================
typedef long long ll;
//typedef __int128 Int;
typedef unsigned long long ul;
typedef long double LD;
#define pd push_back
#define all(x) x.begin(),x.end()
#define allA(x,l,r) x+l,x+r+1
#define mpr std::make_pair
#define ve std::vector
#define mpre(v) v.insert(v.begin(),0)
#define lb lower_bound
//=========================================================
namespace Balance_tree{
struct Mes{
Mes(){}
friend Mes operator + (Mes A,Mes B){
Mes ans;
return ans;
}
};
const int N=2e5+10;
std::mt19937 rnd(time(NULL));
struct Mes_BLT{
struct node{int l,r;ll val;int key,sz;Mes rv,v;}tr[5];//don't forget to promote it
int rot,cnt=0;
std::vector<int> bin;
void pushup(int rt){tr[rt].sz=tr[tr[rt].l].sz+tr[tr[rt].r].sz+1;
if(tr[rt].l&&tr[rt].r)tr[rt].rv=tr[tr[rt].l].rv+tr[rt].v+tr[tr[rt].r].rv;
else if(tr[rt].l)tr[rt].rv=tr[tr[rt].l].rv+tr[rt].v;
else if(tr[rt].r)tr[rt].rv=tr[rt].v+tr[tr[rt].r].v;}
int newid(){
if(bin.empty())return ++cnt;
int x=bin.back();bin.pop_back();
return x;
}void split(int rt,ll val,int &x,int &y){
if(!rt)return x=y=0,void();
if(tr[rt].val<=val)x=rt,split(tr[rt].r,val,tr[rt].r,y);
else y=rt,split(tr[rt].l,val,x,tr[rt].l);
pushup(rt);
}int merge(int x,int y){
if(!x||!y)return x|y;
if(tr[x].key<=tr[y].key)
return tr[x].r=merge(tr[x].r,y),pushup(x),x;
else return tr[y].l=merge(x,tr[y].l),pushup(y),y;
}int build(int val,Mes P){int id=newid();return tr[id]={0,0,val,int(rnd()),1,P,P},id;}
void insert(ll val,Mes P){
int x,y;split(rot,val,x,y);
rot=merge(merge(x,build(val,P)),y);
}void del(ll val){
int x,y,z;split(rot,val,x,z);
split(x,val-1,x,y);bin.pd(y);
rot=merge(merge(x,merge(tr[y].l,tr[y].r)),z);
}Mes query(ll l,ll r){
int x,y,z;split(rot,r,x,z);
split(x,l-1,x,y);
Mes ans=tr[y].rv;
rot=merge(merge(x,y),z);
return ans;
}
void clear(){for(int i=1;i<=cnt;i++)tr[i]={0,0,0,0,0,Mes(),Mes()};cnt=rot=0;bin.clear();}
};
struct Basic_BLT{
struct node{int l,r;ll val;int key,sz;}tr[5];//don't forget to promote it
int rot,cnt=0;
std::vector<int> bin;
void pushup(int rt){tr[rt].sz=tr[tr[rt].l].sz+tr[tr[rt].r].sz+1;}
int newid(){
if(bin.empty())return ++cnt;
int x=bin.back();bin.pop_back();
return x;
}void split(int rt,int val,int &x,int &y){
if(!rt)return x=y=0,void();
if(tr[rt].val<=val)x=rt,split(tr[rt].r,val,tr[rt].r,y);
else y=rt,split(tr[rt].l,val,x,tr[rt].l);
pushup(rt);
}int merge(int x,int y){
if(!x||!y)return x|y;
if(tr[x].key<=tr[y].key)
return tr[x].r=merge(tr[x].r,y),pushup(x),x;
else return tr[y].l=merge(x,tr[y].l),pushup(y),y;
}int build(ll val){int id=newid();return tr[id]={0,0,val,int(rnd()),1},id;}
void insert(ll val){
int x,y;split(rot,val,x,y);
rot=merge(merge(x,build(val)),y);
}void del(ll val){
int x,y,z;split(rot,val,x,z);
split(x,val-1,x,y);bin.pd(y);
rot=merge(merge(x,merge(tr[y].l,tr[y].r)),z);
}int Get_rank(int rt,int k){
if(k<=tr[tr[rt].l].sz)return Get_rank(tr[rt].l,k);
if(k==tr[tr[rt].l].sz+1)return rt;
return Get_rank(tr[rt].r,k-tr[tr[rt].l].sz-1);
}
void clear(){for(int i=1;i<=cnt;i++)tr[i]={0,0,0,0,0};cnt=rot=0;bin.clear();}
};
}
namespace segment_tree{
const int N=2e5+10;
template<typename M,typename T> struct sg_tree{
struct node{M Mes;T Tag;int l,r;}tr[5];
int rot;int cnt;
void init(){for(int i=1;i<=cnt;i++)tr[i].Mes=M(),tr[i].Tag=T(),tr[i].l=tr[i].r=0;rot=cnt=0;}
void pushup(int rt){
tr[rt].Mes=M();
if(tr[rt].l&&tr[rt].r)tr[rt].Mes=tr[tr[rt].l].Mes+tr[tr[rt].r].Mes;
else if(tr[rt].l)tr[rt].Mes=tr[tr[rt].l].Mes;
else if(tr[rt].r)tr[rt].Mes=tr[tr[rt].r].Mes;
}
void addson(int rt,T x){tr[rt].Mes=tr[rt].Mes+x;tr[rt].Tag=tr[rt].Tag+x;}
void pushdown(int rt){
if(tr[rt].Tag==T())return;
if(tr[rt].l)addson(tr[rt].l,tr[rt].Tag);
if(tr[rt].r)addson(tr[rt].r,tr[rt].Tag);
tr[rt].Tag=T();
}
void build(int &rt,int l,int r,std::vector<M> &A){
if(!rt)rt=++cnt;
if(l==r)return tr[rt].Mes=A[l],void();
auto mid=l+r>>1;
build(tr[rt].l,l,mid,A);build(tr[rt].r,mid+1,r,A);
pushup(rt);
}
void change_Seq(int &rt,int l,int r,int x,int y,T P){
if(x>y)return;
if(!rt)rt=++cnt,tr[rt].Mes=M(),tr[rt].Tag=T();
if(x<=l&&r<=y)return addson(rt,P);
auto mid=l+r>>1;pushdown(rt);
if(x<=mid)change_Seq(tr[rt].l,l,mid,x,y,P);
if(y>mid)change_Seq(tr[rt].r,mid+1,r,x,y,P);
pushup(rt);
}
void change_p(int &rt,int l,int r,int x,T P){
if(!rt)rt=++cnt,tr[rt].Mes=M(),tr[rt].Tag=T();
if(l==r)return addson(rt,P);
auto mid=l+r>>1;pushdown(rt);
(x<=mid)?change_p(tr[rt].l,l,mid,x,P):change_p(tr[rt].r,mid+1,r,x,P);
pushup(rt);
}
M query(int rt,int l,int r,int x,int y){
if(!rt||x>y)return M();
if(x<=l&&r<=y)return tr[rt].Mes;
auto mid=l+r>>1;pushdown(rt);
if(x<=mid&&y>mid)return query(tr[rt].l,l,mid,x,y)+query(tr[rt].r,mid+1,r,x,y);
if(x<=mid)return query(tr[rt].l,l,mid,x,y);
if(y>mid)return query(tr[rt].r,mid+1,r,x,y);
assert(false);
}
void build(int l,int r,std::vector<M> &A){build(rot,l,r,A);}
void change_Seq(int l,int r,int x,int y,T P){
change_Seq(rot,l,r,x,y,P);}
void change_p(int l,int r,int x,T P){
change_p(rot,l,r,x,P);}
M query(int l,int r,int x,int y){
return query(rot,l,r,x,y);}
};
struct Mes{
Mes(){}
Mes(ll _S,int _l,int _r){}
Mes operator + (Mes P){
Mes ans=Mes();
return ans;
}
};
struct Tag{
Tag(){}
Tag operator + (Tag P){
Tag ans=Tag();
return ans;
}
bool operator == (Tag P){return true!=false;}
};
Mes operator + (Mes A,Tag B){return A;}
}
namespace Fenwick_Tree{
const int N=2e5+10;
struct FwT{
ll tr[5];int u;
void init(int _u){
u=_u;
for(int i=0;i<=u;i++)tr[i]=0;}
void add(int x,ll y){for(;x<=u;x+=(x&-x))tr[x]+=y;}
ll query(int x){ll ans=0;for(;x;x^=(x&-x))ans+=tr[x];return ans;}
ll query(int l,int r){if(l>r)return 0;return query(r)-query(l-1);}
};
}
//=========================================================
namespace Math{
ll QP(ll x,ll y,ll mod){ll ans=1;for(;y;y>>=1,x=x*x%mod)if(y&1)ans=ans*x%mod;return ans;}
ll QA(ll x,ll y,ll mod){ll ans=0;for(;y;y>>=1,x=(x<<1)%mod)if(y&1)ans=(ans+x)%mod;return ans;}
ll inv(ll x,ll mod){return QP(x,mod-2,mod);}
}
typedef unsigned U;
const int M=998244353;
struct ModInt{
static constexpr U mod=M;
U val;
constexpr ModInt():val(0U){}
constexpr ModInt(U _val):val(_val){}
constexpr ModInt(int _val):val((_val%int(mod)+int(mod))%int(mod)){}
constexpr ModInt(ll _val):val((_val%ll(mod)+ll(mod))%ll(mod)){}
ModInt(const ModInt &P):val(P.val){}
inline ModInt operator +(ModInt p){return ModInt(int(val)+int(p.val));}
inline ModInt operator -(ModInt p){return ModInt(int(val)-int(p.val));}
inline ModInt operator *(ModInt p){return ModInt(1ll*val*p.val);}
inline ModInt QP(ll y){
if(y<0)return inv().QP(-y);
ModInt A=(*this),B=1U;
for(;y;A=A*A,y>>=1)if(y&1)B=B*A;
return B;
}inline ModInt inv(){return QP(mod-2);}
inline ModInt operator /(ModInt p){return (*this)*p.inv();}
inline ModInt operator ^(ModInt p){return QP(p.val);}
template<typename T>
inline ModInt operator ^(T p){return QP(p);}
template<typename T>
inline ModInt operator +(T p){return (*this)+ModInt(p);}
template<typename T>
inline ModInt operator -(T p){return (*this)-ModInt(p);}
template<typename T>
inline ModInt operator *(T p){return (*this)*ModInt(p);}
template<typename T>
inline ModInt operator /(T p){return (*this)/ModInt(p);}
inline ModInt operator +(){return (*this);}
inline ModInt operator -(){return ModInt(0)-(*this);}
template<typename T>
inline friend ModInt operator +(T A,ModInt P){return ModInt(A)+P;}
template<typename T>
inline friend ModInt operator -(T A,ModInt P){return ModInt(A)-P;}
template<typename T>
inline friend ModInt operator *(T A,ModInt P){return ModInt(A)*P;}
template<typename T>
inline friend ModInt operator /(T A,ModInt P){return ModInt(A)/P;}
inline void operator --(){val=(!val?mod-1:val-1);}
inline void operator ++(){val=(val==mod-1?0:val+1);}
inline void operator +=(ModInt P){(*this)=(*this)+P;}
inline void operator -=(ModInt P){(*this)=(*this)-P;}
inline void operator *=(ModInt P){(*this)=(*this)*P;}
inline void operator /=(ModInt P){(*this)=(*this)/P;}
template<typename T>
inline void operator +=(T P){return (*this)=(*this)+ModInt(P);}
template<typename T>
inline void operator -=(T P){return (*this)=(*this)-ModInt(P);}
template<typename T>
inline void operator *=(T P){return (*this)=(*this)*ModInt(P);}
template<typename T>
inline void operator /=(T P){return (*this)=(*this)/ModInt(P);}
template<typename T>
inline void operator ^=(T P){return (*this)=(*this)^P;}
U key(){return val;}
inline bool operator == (ModInt P){return P.val==val;}
inline bool operator != (ModInt P){return !((*this)==P);}
};
//=========================================================
namespace IO{
const double eps=1e-8;
const int BUFSIZE=1<<20;
char ibuf[BUFSIZE],*is=ibuf,*it=ibuf;
char tmp[BUFSIZE];int cnt=0;
inline char getch(){if(is==it)it=(is=ibuf)+fread(ibuf,1,BUFSIZE,stdin);return is==it?EOF:*is++;}
int readInt(){int x=0,y=0;char c=0;while(!isdigit(c))y|=c=='-',c=getch();while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getch();return !y?x:-x;}
ll readLL(){ll x=0,y=0;char c=0;while(!isdigit(c))y|=c=='-',c=getch();while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getch();return !y?x:-x;}
// Int readInt128(){Int x=0;int y=0;char c=0;while(!isdigit(c))y|=c=='-',c=getch();while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getch();return !y?x:-x;}
char readChar(){char c=0;while(!c||c==' '||c=='\n')c=getch();return c;}
std::string readString(){std::string S;char c=0;while(!c||c==' '||c=='\n')c=getch();while(c!=' '&&c!='\n')S.pd(c),c=getch();return S;}
LD readDouble(){LD x=0,d=1;int y=0;char c=0;while(!isdigit(c))y|=c=='-',c=getch();int cnt=0;bool flg=false;while(isdigit(c)){
x=x*10+(c^48),flg|=(c^48),cnt+=flg,c=getch();if(cnt>=12)goto flg;}if(c=='.'){c=getch();while(isdigit(c)){d*=10,x+=(c^48)/d;flg|=(c^48),cnt+=flg;
if(cnt>=12)goto flg;c=getch();}}flg:;return !y?x:-x;}
ul readUll(){ul x=0;char c=0;while(!isdigit(c))c=getch();while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getch();return x;}
void flush(){fwrite(tmp,1,cnt,stdout);cnt=0;}
void putch(char c){tmp[cnt++]=c;if(cnt==BUFSIZE)flush();}
void putint(int x){char Q[10];int tp=0;if(x<0)putch('-'),x=-x;if(x==0)putch('0');while(x)Q[tp++]=(x%10+'0'),x/=10;while(tp--)putch(Q[tp]);}
// void putInt128(Int x){char Q[45];int tp=0;if(x<0)putch('-'),x=-x;if(x==0)putch('0');while(x)Q[tp++]=(x%10+'0'),x/=10;while(tp--)putch(Q[tp]);}
void putLL(ll x){char Q[20];int tp=0;if(x<0)putch('-'),x=-x;if(x==0)putch('0');while(x)Q[tp++]=(x%10+'0'),x/=10;while(tp--)putch(Q[tp]);}
void putString(std::string x){for(auto p:x)putch(p);}
void putDouble(LD x){if(x<0)x=-x,putch('-');if(fabs(x)<=eps)return putch(0);bool flg=false;LD d=1e10;LD l=std::min(LD(1e-10),1.0/std::max(LD(1),x));
while(d>=l){if(d<=1){if(ll(x/d+d*1e-2)%10>0||flg)putch(ll(x/d+d*1e-2)%10+'0'),flg=true;}else{if(ll(x/d)%10>0||flg)putch(ll(x/d)%10+'0'),flg=true;
}x-=ll(x/d+eps)*d; if(d==1){if(!flg)putch('0');putch('.');}d/=10;}}
void putUll(ul x){char Q[25];int tp=0;if(!x)putch('0');while(x)Q[tp++]=(x%10+'0'),x/=10;while(tp--)putch(Q[tp]);}
struct Basic{
Basic &operator>>(int &A){A=IO::readInt();return (*this);}
Basic &operator>>(ll &A){A=IO::readLL();return (*this);}
// Basic &operator>>(Int &A){A=IO::readInt128();return (*this);}
Basic &operator>>(char &A){A=IO::readChar();return (*this);}
Basic &operator>>(std::string &A){A=IO::readString();return (*this);}
Basic &operator>>(double &A){A=IO::readDouble();return (*this);}
Basic &operator>>(LD &A){A=IO::readDouble();return (*this);}
Basic &operator>>(float &A){A=IO::readDouble();return (*this);}
template<typename T1,typename T2>
Basic &operator>>(std::pair<T1,T2>&v){(*this)>>v.first>>v.second;return (*this);}
template<typename T,int d>
Basic &operator>>(std::array<T,d> &v){for(auto &p:v)(*this)>>p;return (*this);}
template<typename T>
Basic &operator>>(std::vector<T> &v){for(auto &p:v)(*this)>>p;return (*this);}
Basic &operator>>(ul &v){v=readUll();return (*this);}
Basic &operator<<(const int &A){putint(A);return (*this);}
Basic &operator<<(const char &A){putch(A);return (*this);}
Basic &operator<<(const ll &A){putLL(A);return (*this);}
// Basic &operator<<(const Int &A){putInt128(A);return (*this);}
Basic &operator<<(const std::string &A){putString(A);return (*this);}
Basic &operator<<(const LD &A){putDouble(A);return (*this);}
Basic &operator<<(const double &A){putDouble(A);return (*this);}
Basic &operator<<(const float &A){putDouble(A);return (*this);}
template<typename T>
Basic &operator<<(const std::vector<T> &v){for(int i=0;i<v.size();i++)(*this)<<v[i]<<(v.size()==i+1?'\n':' ');return (*this);}
Basic &operator<<(const ul &A){putUll(A);return (*this);}
void Flush(){flush();}
}cin,cout;
}
//=========================================================
namespace Grader{
std::vector<int>S;
void Get(std::vector<int>v){
assert(S.empty());
reverse(all(S));
}
int readInt(){
assert(!S.empty());
int x=S.back();
S.pop_back();
return x;
}
void putInt(int x){
std::vector<int>P;
P.pd(x);Get(P);
}void putVec(std::vector<int>v){Get(v);}
}
//=========================================================
bool FileIfstream(std::string name){
std::ifstream f(name.c_str());
return f.good();
}
//=========================================================
//const int mod=998244353;
//int add(int x,int y){x+=y;if(x>=mod)x-=mod;if(x<0)x+=mod;return x;}
//int mul(int x,int y){return 1ll*x*y%mod;}
//void add(int &x,int y){x+=y;if(x>=mod)x-=mod;if(x<0)x+=mod;}
const int N=2e5+10;
const ll inf=0x3f3f3f3f3f3f3f3f;
struct costDinic{
struct node{int y,nxt;ll val,c;}E[N<<1];
int H[N],cnt;
void add(int x,int y,ll z,ll c){E[++cnt]={y,H[x],z,c};H[x]=cnt;}
void Add(int x,int y,ll z,ll c){add(x,y,z,c);add(y,x,0,-c);}
int dep[N],cur[N];ll dis[N];
int S,T,n;ll C;
bool vis[N];
void init(int _S,int _T,int _n){
S=_S;T=_T;n=_n;
for(int i=1;i<=_n;i++)dep[i]=cur[i]=dis[i]=vis[i]=0;
for(int i=1;i<=n;i++)H[i]=0;
cnt=1;C=0;
}
bool SPFA(){
for(int i=1;i<=n;i++)dis[i]=inf;
std::queue<int>q;q.push(S);
dis[S]=0;vis[S]=true;
while(!q.empty()){
auto x=q.front();q.pop();vis[x]=false;
for(int i=H[x];i;i=E[i].nxt){
auto y=E[i].y;
if(E[i].val&&dis[x]+E[i].c<dis[y]){
dis[y]=dis[x]+E[i].c;
if(!vis[y])q.push(y),vis[y]=true;
}
}
}return dis[T]!=inf;
}
ll dfs(int x,ll mf){
if(x==T)return mf;ll ans=0;vis[x]=true;
for(int &i=cur[x];i&&ans<mf;i=E[i].nxt){
auto y=E[i].y;
if(!vis[y]&&E[i].val&&dis[y]==dis[x]+E[i].c){
ll f=dfs(y,std::min(E[i].val,mf-ans));
if(f)C+=f*E[i].c,E[i].val-=f,E[i^1].val+=f,ans+=f;
}
}vis[x]=false;
return ans;
}
std::pair<ll,ll>Dinic(){
C=0;
ll ans=0,x;
while(SPFA()){
memcpy(cur,H,(n+5)*sizeof(int));
while(x=dfs(S,inf))ans+=x;
}
// IO::cout<<ans<<' '<<C<<'\n';
return mpr(ans,C);
}
}E;
void solve(){
//don't forget to open long long
int S,T,T0;
int n,m,D;IO::cin>>n>>m>>D;
ve<ve<int>>v1(n+1,ve<int>(m+1)),v2(n+1,ve<int>(m+1));
for(int i=1;i<=n;i++)
for(int j=1;j<m;j++)
IO::cin>>v1[i][j];
for(int i=1;i<n;i++)
for(int j=1;j<=m;j++)
IO::cin>>v2[i][j];
auto to=[&](int i,int j)->int{return (i-1)*(m-1)+j;};
E.init(S=to(n-1,m-1)+1,T0=to(n-1,m-1)+3,(n-1)*(m-1)+3);
T=to(n-1,m-1)+2;
for(int i=1;i<n;i++)
for(int j=1;j<m;j++){
// IO::cout<<to(i,j)<<' '<<to(i+1,j)<<' '<<to(i,j+1)<<'\n';
if(i+1<n)E.Add(to(i+1,j),to(i,j),v1[i+1][j],0),
E.Add(to(i,j),to(i+1,j),v1[i+1][j],0);
// if(i+1<n)IO::cout<<v1[i+1][j]<<' ';
if(j+1<m)E.Add(to(i,j+1),to(i,j),v2[i][j+1],0),
E.Add(to(i,j),to(i,j+1),v2[i][j+1],0);
// if(j+1<m)IO::cout<<v2[i][j+1]<<' ';
// IO::cout<<'\n';
}
for(int i=1;i<m;i++)
E.Add(to(1,i),T,v1[1][i],0),
E.Add(S,to(n-1,i),v1[n][i],0);
E.Add(T,T0,inf,0);
E.Dinic();
for(int i=E.H[T0];i;i=E.E[i].nxt){
E.E[i].val=0;
E.E[i^1].val=0;
}
E.Add(T,T0,D,0);
for(int i=1;i<n;i++)
for(int j=1;j<m;j++){
if(i+1<n)E.Add(to(i+1,j),to(i,j),inf,1),
E.Add(to(i,j),to(i+1,j),inf,1);
if(j+1<m)E.Add(to(i,j+1),to(i,j),inf,1),
E.Add(to(i,j),to(i,j+1),inf,1);
}
for(int i=1;i<m;i++)
E.Add(to(1,i),T,inf,1),
E.Add(S,to(n-1,i),inf,1);
ll VAL=E.Dinic().second;
IO::cout<<VAL<<'\n';
auto rec=[&](int x)->std::pair<int,int>{return {(x-1)/(m-1)+1,(x-1)%(m-1)+1};};
for(int V=1;V<=(n-1)*(m-1)+1;V++){
for(int i=E.H[V];i;i=E.E[i].nxt){
int y=E.E[i].y;
// IO::cout<<rec(V).first<<' '<<rec(V).second<<' '<<rec(y).first<<' '<<rec(y).second<<' '<<E.E[i].c<<' '<<E.E[i^1].val<<'\n';
if(E.E[i].c<=0)continue;
int d=E.E[i^1].val;
if(y==T)v1[1][rec(V).second]+=d;
else if(V==S)v1[n][rec(y).second]+=d;
else if(rec(V).first!=rec(y).first)
v1[std::max(rec(V).first,rec(y).first)][rec(V).second]+=d;
else v2[rec(V).first][std::max(rec(V).second,rec(y).second)]+=d;
}
}
for(int i=1;i<=n;i++)
for(int j=1;j<m;j++)
IO::cout<<v1[i][j]<<(j+1==m?'\n':' ');
for(int i=1;i<n;i++)
for(int j=1;j<=m;j++)
IO::cout<<v2[i][j]<<(j==m?'\n':' ');
}
int main(){
#ifndef ONLINE_JUDGE
if(!FileIfstream("IO.in")){
freopen("IO.in","w",stdout);
return 0;
}
freopen("IO.in","r",stdin);
freopen("IO.out","w",stdout);
#endif
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
//std::cout.tie(0);
int T=1;IO::cin>>T;
while(T--)solve();
IO::cout.Flush();
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 9960kb
input:
2 3 4 6 2 1 15 7 1 9 13 3 2 3 6 1 2 5 2 15 3 3 3 3 1 1 2 2 3 3 1 1 1 2 2 2
output:
9 4 1 15 7 1 12 13 3 6 3 6 1 2 5 2 15 3 4 2 3 3 2 3 3 1 1 1 2 2 2
result:
ok Correct. (2 test cases)
Test #2:
score: 0
Accepted
time: 3ms
memory: 9940kb
input:
125 4 4 48 33 9 39 38 74 3 18 44 9 20 91 19 76 95 17 16 61 88 50 49 68 18 33 84 4 4 14 54 69 42 47 90 28 2 73 59 1 20 90 43 22 74 19 27 67 46 43 42 21 78 80 4 4 93 12 67 38 13 85 39 74 68 77 71 80 64 92 97 53 46 66 6 30 20 66 70 71 24 4 4 34 43 86 55 49 34 73 78 77 90 99 49 5 55 4 63 47 80 24 15 3 8...
output:
87 33 38 39 38 74 22 18 83 9 20 91 19 76 95 17 16 61 88 50 49 68 18 33 84 14 54 69 42 47 90 28 2 73 59 1 20 104 43 22 74 19 27 67 46 43 42 21 78 80 166 58 97 55 59 104 47 74 68 77 71 80 64 92 97 53 46 66 6 30 20 66 70 71 24 34 43 86 55 49 34 73 78 77 90 99 49 39 55 4 63 47 80 24 15 3 85 12 6 31 45 4...
result:
ok Correct. (125 test cases)
Test #3:
score: 0
Accepted
time: 4ms
memory: 9856kb
input:
80 5 5 97 10 18 14 13 17 15 16 11 15 10 14 15 12 17 12 15 12 11 15 15 19 19 13 19 19 19 17 10 10 19 12 13 18 11 20 12 17 14 13 12 5 5 65 13 15 13 20 18 19 13 20 10 19 18 17 19 19 11 14 12 18 11 10 18 14 18 19 18 20 11 17 11 17 16 13 19 18 13 16 14 17 11 18 5 5 3 15 10 10 18 17 17 17 14 13 15 15 19 1...
output:
473 10 22 14 104 17 15 16 102 15 12 14 109 12 17 12 109 12 11 15 112 19 19 13 19 19 19 17 10 10 19 12 13 18 11 20 12 17 14 13 12 271 13 19 18 66 18 19 13 66 10 19 18 69 19 19 11 67 12 18 11 75 18 14 18 19 18 20 11 17 11 17 16 13 19 18 13 16 14 17 11 18 3 15 13 10 18 17 17 17 14 13 15 15 19 10 18 16 ...
result:
ok Correct. (80 test cases)
Test #4:
score: 0
Accepted
time: 5ms
memory: 9860kb
input:
55 6 6 98 943830625 154853276 396311720 585129723 216006508 789713291 522861691 174874210 616414184 931597164 831871942 149821142 520941619 814161584 200419736 646044877 574761262 188910317 673355715 723256093 264106685 163628126 318085983 226850181 101764170 179381345 486537031 346100002 805792579 ...
output:
98 943830625 154853276 396311720 585129723 216006508 789713291 522861691 174874210 616414184 931597164 831871942 149821142 520941619 814161584 200419736 646044877 574761262 188910317 673355715 723256093 264106685 163628126 318085983 226850181 101764268 179381345 486537031 346100002 805792579 5081942...
result:
ok Correct. (55 test cases)
Test #5:
score: 0
Accepted
time: 5ms
memory: 10196kb
input:
55 6 6 96 16739843 17336211 10384494 17185421 10646458 18552039 13790956 13642043 10307995 14193711 19297204 12810329 18681558 18724838 16636750 11505737 19658923 19307194 12241535 15070027 16123862 17524159 19471242 14316479 10954501 10604286 17691735 17352365 14092770 19909253 11761060 19372581 16...
output:
96 16739843 17336211 10384494 17185421 10646458 18552039 13790956 13642139 10307995 14193711 19297204 12810329 18681558 18724838 16636750 11505737 19658923 19307194 12241535 15070027 16123862 17524159 19471242 14316479 10954501 10604286 17691735 17352365 14092770 19909253 11761060 19372581 16863139 ...
result:
ok Correct. (55 test cases)
Test #6:
score: 0
Accepted
time: 7ms
memory: 9868kb
input:
40 7 7 17 27500 8466 7754 5254 45204 36821 35457 23725 45494 26962 24728 31437 46232 38720 23756 17265 21004 25959 29727 6060 23244 45236 39610 23968 17068 14954 9745 28949 20957 30885 8272 49710 28660 17038 12058 48058 10306 5065 45011 25264 25765 17423 21072 22743 17503 11324 10214 6879 22253 1729...
output:
17 27500 8483 7754 5254 45204 36821 35457 23725 45494 26962 24728 31437 46232 38720 23756 17265 21004 25959 29727 6060 23244 45236 39610 23968 17068 14954 9745 28949 20957 30885 8272 49710 28660 17038 12058 48058 10306 5065 45011 25264 25765 17423 21072 22743 17503 11324 10214 6879 22253 17295 49299...
result:
ok Correct. (40 test cases)
Test #7:
score: 0
Accepted
time: 7ms
memory: 9940kb
input:
31 8 8 84 82373 175391 615535 844446 885043 54908 235817 174599 782716 140021 505505 551220 980613 844864 490309 720051 436451 436322 357173 349094 303200 428983 865478 890817 50236 172208 96832 261006 265321 413840 490656 677420 172238 872751 182871 957260 978182 971447 603592 37811 282590 470570 1...
output:
84 82373 175391 615535 844446 885043 54908 235817 174599 782716 140021 505505 551220 980613 844864 490309 720051 436451 436322 357173 349094 303200 428983 865478 890817 50236 172208 96916 261006 265321 413840 490656 677420 172238 872751 182871 957260 978182 971447 603592 37811 282590 470570 134862 3...
result:
ok Correct. (31 test cases)
Test #8:
score: 0
Accepted
time: 14ms
memory: 9900kb
input:
24 9 9 80 178 146 100 118 196 180 100 110 153 125 200 139 174 169 163 196 173 167 120 182 172 142 188 132 160 150 148 171 162 125 180 152 159 152 161 177 106 129 152 114 179 132 146 126 107 148 141 151 165 123 151 153 112 151 148 182 105 188 136 199 173 192 117 118 116 190 103 198 125 150 105 118 15...
output:
227 178 146 100 160 211 180 100 110 153 125 200 139 174 169 163 196 173 167 120 182 172 142 188 132 160 150 148 171 162 125 180 152 159 187 161 177 106 129 152 114 179 169 162 128 107 148 141 151 165 123 151 153 112 151 148 182 105 188 136 199 173 192 117 118 116 190 103 198 125 150 105 198 157 130 ...
result:
ok Correct. (24 test cases)
Test #9:
score: 0
Accepted
time: 7ms
memory: 9920kb
input:
20 10 10 91 90000001 90000000 90000001 90000000 90000001 90000000 90000000 90000001 90000000 90000001 90000001 90000001 90000001 90000000 90000001 90000001 90000001 90000001 90000001 90000001 90000001 90000000 90000000 90000000 90000001 90000000 90000000 90000000 90000001 90000001 90000001 90000000 ...
output:
886 90000001 90000000 90000001 90000000 90000005 90000000 90000000 90000001 90000086 90000001 90000001 90000001 90000001 90000000 90000001 90000001 90000001 90000087 90000001 90000001 90000001 90000000 90000003 90000000 90000001 90000000 90000087 90000000 90000001 90000001 90000001 90000000 90000001...
result:
ok Correct. (20 test cases)
Test #10:
score: 0
Accepted
time: 24ms
memory: 9988kb
input:
10 14 14 68 20 23 20 22 23 26 23 22 28 30 25 20 29 22 30 26 20 22 21 26 23 23 22 22 22 21 24 29 30 30 24 20 25 23 30 27 27 26 24 30 25 25 24 26 26 23 22 22 30 24 20 23 27 24 29 24 22 24 21 20 20 28 24 21 28 20 24 25 29 20 30 30 30 30 24 27 23 28 29 25 25 26 21 27 23 25 25 27 23 27 23 23 22 27 27 29 ...
output:
607 20 23 20 22 23 33 45 22 28 30 25 20 57 22 30 26 20 22 32 51 27 23 22 22 22 49 24 29 30 30 24 20 26 23 30 27 27 26 52 30 25 25 24 26 26 43 22 22 30 24 20 51 27 24 29 24 22 24 49 20 20 28 24 21 56 20 24 25 29 20 30 30 30 30 24 27 23 56 29 25 25 26 21 36 23 25 25 27 23 27 56 23 22 27 27 29 30 25 24...
result:
ok Correct. (10 test cases)
Test #11:
score: 0
Accepted
time: 24ms
memory: 10152kb
input:
10 10 20 79 1001 1003 1000 1003 1001 1003 1002 1003 1001 1003 1003 1000 1001 1001 1001 1002 1002 1003 1002 1001 1003 1001 1001 1001 1000 1003 1002 1000 1002 1001 1001 1003 1000 1001 1003 1001 1001 1000 1001 1003 1000 1002 1003 1003 1003 1001 1002 1002 1000 1002 1003 1001 1003 1000 1002 1000 1002 100...
output:
732 1001 1003 1000 1003 1001 1003 1002 1003 1001 1003 1003 1000 1001 1001 1001 1002 1002 1003 1070 1001 1003 1001 1001 1003 1000 1005 1008 1000 1002 1001 1001 1003 1000 1001 1003 1001 1001 1068 1001 1003 1000 1002 1005 1003 1003 1001 1002 1002 1000 1002 1003 1001 1003 1000 1002 1000 1070 1002 1003 1...
result:
ok Correct. (10 test cases)
Test #12:
score: 0
Accepted
time: 42ms
memory: 10216kb
input:
10 20 10 21 777601561 917773453 313011120 861769383 651010533 771534309 418153755 749795307 939533489 769621271 705696594 863041783 330858635 136276987 569175453 21935211 559486868 264609946 30013079 725693020 492377730 630078388 365743281 693415122 589281054 690370363 47310510 125777481 136448711 5...
output:
21 777601561 917773453 313011120 861769383 651010533 771534309 418153755 749795307 939533489 769621271 705696594 863041783 330858635 136276987 569175453 21935211 559486868 264609946 30013079 725693020 492377730 630078388 365743281 693415122 589281054 690370363 47310510 125777481 136448711 508925654 ...
result:
ok Correct. (10 test cases)
Test #13:
score: 0
Accepted
time: 2ms
memory: 9984kb
input:
24 6 2 37 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 18 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
222 38 38 38 38 38 38 1 1 1 1 1 1 1 1 1 1 117 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1...
result:
ok Correct. (24 test cases)
Test #14:
score: 0
Accepted
time: 7ms
memory: 9996kb
input:
31 9 3 33 1 5 4 5 3 4 4 2 5 3 4 3 2 5 5 5 4 3 5 1 4 2 1 2 1 5 3 5 3 2 2 3 2 3 5 3 4 4 3 1 4 2 2 3 4 3 2 5 2 1 3 5 12 6 72 2 2 1 1 5 1 2 5 1 4 5 5 1 2 3 4 1 4 4 4 1 2 2 2 5 5 5 3 5 3 2 1 1 3 5 4 1 4 2 1 4 2 1 5 3 3 3 2 4 5 5 5 2 3 3 4 3 4 5 1 3 5 5 5 1 1 5 5 3 2 5 3 5 3 1 4 3 3 5 4 5 1 3 5 2 3 3 5 4 ...
output:
284 3 36 4 35 5 34 7 32 6 33 6 33 4 35 5 34 4 35 5 1 4 2 1 2 1 5 3 5 3 2 2 3 2 3 5 3 4 4 3 1 4 2 6 5 4 5 4 1 3 5 803 2 7 6 2 65 1 7 8 2 64 5 6 4 4 63 6 4 4 4 64 3 4 6 3 66 5 5 3 5 64 5 2 4 6 65 7 2 5 2 66 7 3 1 5 66 6 3 2 4 67 5 5 2 4 66 4 5 4 5 64 3 5 5 5 1 1 5 5 3 2 5 3 5 3 1 4 3 3 5 4 5 1 3 5 2 3...
result:
ok Correct. (31 test cases)
Test #15:
score: 0
Accepted
time: 6ms
memory: 10036kb
input:
27 14 3 50 998244355 998244354 998244353 998244355 998244355 998244354 998244353 998244353 998244353 998244354 998244353 998244354 998244355 998244353 998244354 998244354 998244355 998244354 998244354 998244354 998244355 998244355 998244354 998244355 998244354 998244355 998244354 998244353 998244354...
output:
670 998244355 998244401 998244354 998244402 998244355 998244401 998244355 998244401 998244355 998244401 998244355 998244401 998244356 998244400 998244355 998244401 998244355 998244401 998244355 998244401 998244355 998244401 998244354 998244402 998244354 998244402 998244354 998244402 998244354 998244...
result:
ok Correct. (27 test cases)
Test #16:
score: 0
Accepted
time: 13ms
memory: 9928kb
input:
23 20 8 97 65608 5872 94352 46988 59846 12493 44992 76156 71668 37922 41038 63074 89348 52169 86215 13124 34107 56625 89609 74457 68595 4701 48937 41711 40122 4771 27822 49478 44146 33934 94003 46579 70799 92669 73897 74846 46044 73186 49298 7012 81846 33315 73703 6101 59247 53180 31956 19735 66252 ...
output:
97 65608 5872 94352 46988 59846 12493 44992 76156 71668 37922 41038 63074 89348 52169 86215 13124 34107 56625 89609 74457 68595 4701 48937 41711 40122 4771 27919 49478 44146 33934 94003 46579 70799 92669 73897 74846 46044 73186 49298 7012 81846 33315 73703 6101 59247 53180 31956 19735 66252 16794 81...
result:
ok Correct. (23 test cases)
Test #17:
score: 0
Accepted
time: 58ms
memory: 10164kb
input:
19 8 19 24 902387291 907620818 994686428 993181541 945788800 985461854 930840176 976723143 978273460 908804932 947598154 948392387 906663045 945746194 935677070 906756920 944967394 995192049 971027077 958873510 947130283 938614195 938536007 978161927 948149370 943899083 936971628 979751238 924273778...
output:
24 902387291 907620818 994686428 993181541 945788800 985461854 930840176 976723143 978273460 908804932 947598154 948392387 906663045 945746194 935677070 906756920 944967394 995192049 971027077 958873510 947130283 938614195 938536007 978161927 948149370 943899083 936971628 979751238 924273778 9948463...
result:
ok Correct. (19 test cases)
Test #18:
score: 0
Accepted
time: 10ms
memory: 10020kb
input:
17 8 6 73 454 453 255 154 145 234 372 334 453 446 475 154 423 475 172 348 129 504 471 299 381 454 313 281 135 313 366 411 397 449 137 361 216 132 284 231 127 338 217 508 7722 2335 6535 3174 7625 7253 1724 4688 3487 5118 746 2569 1333 8705 5312 7854 7121 8830 1497 1091 1873 8673 7066 9654 6715 1904 6...
output:
73 454 453 255 154 145 234 372 334 453 446 475 154 423 475 172 348 129 504 471 299 381 454 313 281 135 313 366 411 397 449 150 408 229 132 284 231 127 338 217 508 7722 2335 6535 3174 7625 7253 1724 4688 3487 5118 746 2569 1333 8705 5312 7854 7121 8830 1497 1091 1873 8673 7066 9654 6715 1904 6931 130...
result:
ok Correct. (17 test cases)
Test #19:
score: 0
Accepted
time: 2ms
memory: 10176kb
input:
23 88 2 97 841315194 845068923 970975198 957201780 251777303 404708591 2727155 669564257 336704019 803214539 649487089 931208031 194958628 208113257 766983395 773886317 969081031 767526283 94213588 872004907 742843321 70045653 828417878 78044768 948026239 74041166 698029055 507301238 56824543 257615...
output:
97 841315194 845068923 970975198 957201780 251777303 404708591 2727252 669564257 336704019 803214539 649487089 931208031 194958628 208113257 766983395 773886317 969081031 767526283 94213588 872004907 742843321 70045653 828417878 78044768 948026239 74041166 698029055 507301238 56824543 257615587 9794...
result:
ok Correct. (23 test cases)
Test #20:
score: 0
Accepted
time: 6ms
memory: 10012kb
input:
19 2 75 29 919738918 817415784 547071389 765591923 840765371 272558012 857925393 355491607 630197873 232681522 488447662 651935225 655063717 94077244 436556672 393624718 961794361 486877806 959891293 894435244 411013650 92339205 12625243 190596368 124067993 451522398 927510612 174581723 914056251 79...
output:
29 919738918 817415784 547071389 765591923 840765371 272558012 857925393 355491607 630197873 232681522 488447662 651935225 655063717 94077244 436556672 393624718 961794361 486877806 959891293 894435244 411013650 92339205 12625243 190596368 124067993 451522398 927510612 174581723 914056251 791511418 ...
result:
ok Correct. (19 test cases)
Test #21:
score: 0
Accepted
time: 1ms
memory: 9864kb
input:
1 5 6 10 1 1 1 1 100 1 1 2 100 100 100 1 1 1 100 100 100 2 1 1 100 1 1 1 1 1 100 100 100 1 100 100 100 100 2 1 100 100 1 2 100 100 100 100 1 100 100 100 1
output:
10 1 1 1 1 100 2 1 2 100 100 100 1 10 1 100 100 100 2 1 1 100 1 1 1 1 1 100 100 100 1 100 100 100 100 2 1 100 100 1 2 100 100 100 100 1 100 100 100 1
result:
ok Correct. (1 test case)
Test #22:
score: 0
Accepted
time: 1ms
memory: 9860kb
input:
2 5 6 100 1 2 1 1 100 1 1 2 100 100 100 1 1 1 100 100 100 2 1 1 100 1 1 1 1 2 100 100 100 1 100 100 100 100 2 1 100 100 1 2 100 100 100 100 1 100 100 100 2 6 5 100 1 100 100 100 100 100 2 1 100 100 2 100 100 2 100 100 1 1 100 100 100 100 100 1 2 1 100 100 100 1 1 1 100 1 1 2 2 2 1 1 100 1 1 1 100 10...
output:
117 1 2 1 9 100 3 1 2 100 100 100 1 82 1 100 100 100 2 1 10 100 1 1 1 10 2 100 100 100 1 100 100 100 100 10 1 100 100 1 2 100 100 100 100 1 100 100 100 2 101 1 100 100 100 100 100 4 3 100 100 2 100 100 2 100 100 1 5 100 100 100 100 100 2 2 1 100 100 100 1 1 1 100 1 1 2 94 2 1 1 100 1 1 1 100 100 100...
result:
ok Correct. (2 test cases)
Test #23:
score: 0
Accepted
time: 0ms
memory: 9928kb
input:
55 6 6 98 396311720 585129723 216006508 789713291 522861691 585129723 216006508 789713291 522861691 174874210 216006508 789713291 522861691 174874210 616414184 789713291 522861691 174874210 616414184 931597164 522861691 174874210 616414184 931597164 831871942 174874210 616414184 931597164 831871942 ...
output:
98 396311720 585129723 216006508 789713291 522861691 585129723 216006508 789713291 522861691 174874210 216006508 789713291 522861691 174874210 616414184 789713291 522861691 174874210 616414184 931597164 522861691 174874210 616414184 931597164 831871942 174874308 616414184 931597164 831871942 1498211...
result:
ok Correct. (55 test cases)
Test #24:
score: 0
Accepted
time: 5ms
memory: 9928kb
input:
55 6 6 96 10384494 17185421 10646458 18552039 13790956 17185421 10646458 18552039 13790956 13642043 10646458 18552039 13790956 13642043 10307995 18552039 13790956 13642043 10307995 14193711 13790956 13642043 10307995 14193711 19297204 13642043 10307995 14193711 19297204 12810329 10384494 17185421 10...
output:
96 10384494 17185421 10646458 18552039 13790956 17185421 10646458 18552039 13790956 13642043 10646458 18552135 13790956 13642043 10307995 18552039 13790956 13642043 10307995 14193711 13790956 13642043 10307995 14193711 19297204 13642043 10307995 14193711 19297204 12810329 10384494 17185421 10646458 ...
result:
ok Correct. (55 test cases)
Test #25:
score: 0
Accepted
time: 3ms
memory: 9968kb
input:
31 8 8 84 615535 844446 885043 54908 235817 174599 782716 844446 885043 54908 235817 174599 782716 140021 885043 54908 235817 174599 782716 140021 505505 54908 235817 174599 782716 140021 505505 551220 235817 174599 782716 140021 505505 551220 980613 174599 782716 140021 505505 551220 980613 844864 ...
output:
84 615535 844446 885043 54908 235817 174599 782716 844446 885043 54908 235817 174599 782716 140021 885043 54908 235817 174599 782716 140021 505505 54992 235817 174599 782716 140021 505505 551220 235817 174599 782716 140021 505505 551220 980613 174599 782716 140021 505505 551220 980613 844864 782716 ...
result:
ok Correct. (31 test cases)
Test #26:
score: 0
Accepted
time: 10ms
memory: 9952kb
input:
24 9 9 80 100 118 196 180 100 110 153 125 118 196 180 100 110 153 125 200 196 180 100 110 153 125 200 139 180 100 110 153 125 200 139 174 100 110 153 125 200 139 174 169 110 153 125 200 139 174 169 163 153 125 200 139 174 169 163 196 125 200 139 174 169 163 196 173 200 139 174 169 163 196 173 167 10...
output:
80 100 118 196 256 104 110 153 125 118 196 180 100 110 153 125 200 196 180 100 110 153 125 200 139 180 100 110 153 125 200 139 174 100 110 153 125 200 139 174 169 110 153 125 200 139 174 169 163 153 125 200 139 174 169 163 196 125 200 139 174 169 163 196 173 200 139 174 169 163 196 173 167 100 118 1...
result:
ok Correct. (24 test cases)
Test #27:
score: 0
Accepted
time: 6ms
memory: 9856kb
input:
20 10 10 91 90000001 90000000 90000001 90000000 90000000 90000001 90000000 90000001 90000001 90000000 90000001 90000000 90000000 90000001 90000000 90000001 90000001 90000001 90000001 90000000 90000000 90000001 90000000 90000001 90000001 90000001 90000001 90000000 90000000 90000001 90000000 90000001 ...
output:
895 90000001 90000000 90000002 90000000 90000002 90000001 90000000 90000001 90000089 90000000 90000001 90000001 90000000 90000003 90000000 90000001 90000001 90000089 90000001 90000000 90000001 90000001 90000001 90000001 90000001 90000001 90000089 90000000 90000000 90000002 90000000 90000003 90000001...
result:
ok Correct. (20 test cases)
Test #28:
score: 0
Accepted
time: 22ms
memory: 9988kb
input:
10 14 14 68 20 22 23 26 23 22 28 30 25 20 29 22 30 22 23 26 23 22 28 30 25 20 29 22 30 26 23 26 23 22 28 30 25 20 29 22 30 26 20 26 23 22 28 30 25 20 29 22 30 26 20 22 23 22 28 30 25 20 29 22 30 26 20 22 21 22 28 30 25 20 29 22 30 26 20 22 21 26 28 30 25 20 29 22 30 26 20 22 21 26 23 30 25 20 29 22 ...
output:
755 20 22 23 26 23 22 34 30 25 20 29 22 72 22 23 26 23 22 28 30 25 20 29 22 30 68 23 26 23 22 28 30 25 20 29 22 30 26 64 26 23 22 28 30 25 20 29 22 30 26 20 67 23 22 28 30 25 20 33 22 30 26 20 22 67 22 28 30 25 20 29 23 30 26 20 22 21 72 28 30 25 20 29 22 30 26 20 22 21 26 69 30 25 20 29 22 30 26 20...
result:
ok Correct. (10 test cases)
Test #29:
score: 0
Accepted
time: 3ms
memory: 9912kb
input:
178 3 3 53 5 2 4 5 4 2 2 5 1 3 3 1 2 2 90 2 1 2 4 4 5 77 2 3 5 5 5 5 5 3 1 4 4 5 5 3 3 5 2 3 5 4 2 4 4 5 2 3 5 2 4 5 3 3 3 57 4 3 5 3 1 1 5 4 2 1 5 4 2 4 54 4 3 4 3 3 4 1 3 3 5 5 4 89 1 2 3 2 3 3 1 5 1 1 5 4 4 4 4 2 5 1 3 1 1 1 1 5 5 4 3 4 5 3 4 3 3 71 2 2 2 4 3 5 2 1 1 3 1 3 2 2 28 4 5 5 3 2 4 67 2...
output:
155 6 53 4 55 4 55 2 5 1 3 3 1 179 91 91 2 4 301 2 5 6 78 5 5 5 76 3 4 6 78 5 3 3 80 2 3 5 4 2 4 4 5 2 3 5 2 4 5 3 160 4 55 5 54 1 58 5 4 2 1 5 4 107 4 3 57 3 3 58 1 3 3 5 432 3 5 87 4 5 86 3 7 85 3 5 87 4 4 87 2 5 1 3 1 1 1 1 5 5 4 3 4 5 3 4 207 5 70 4 71 3 72 2 1 1 3 1 3 55 32 32 5 3 132 4 2 67 3 ...
result:
ok Correct. (178 test cases)
Test #30:
score: 0
Accepted
time: 10ms
memory: 10164kb
input:
25 11 14 66 998244354 998244355 998244354 998244353 998244355 998244354 998244355 998244355 998244353 998244354 998244353 998244353 998244355 998244354 998244353 998244353 998244355 998244355 998244353 998244353 998244354 998244353 998244355 998244353 998244355 998244354 998244353 998244354 99824435...
output:
678 998244354 998244355 998244354 998244353 998244355 998244355 998244355 998244355 998244353 998244354 998244353 998244353 998244414 998244354 998244353 998244353 998244355 998244355 998244356 998244354 998244354 998244353 998244355 998244353 998244355 998244413 998244353 998244354 998244354 998244...
result:
ok Correct. (25 test cases)
Test #31:
score: 0
Accepted
time: 10ms
memory: 9932kb
input:
24 6 9 73 78341 926193143 45972 89662 44179 39258 14522 928569793 79027 37377 30172 71689 54024 923464835 924430887 51505 58776 28871 83814 38691 29833 97617 58712 28722 15902 86266 962252400 27827 905696913 918736501 95599 4669 958072131 65347 27295 68035 95757 92683 65837 2171 3624 17191 63486 455...
output:
73 78341 926193143 45972 89662 44179 39258 14522 928569793 79027 37377 30172 71689 54024 923464835 924430887 51505 58776 28871 83814 38691 29833 97617 58712 28722 15902 86266 962252400 27827 905696913 918736501 95599 4669 958072131 65347 27295 68035 95757 92683 65837 2171 3624 17191 63486 45593 3836...
result:
ok Correct. (24 test cases)
Test #32:
score: 0
Accepted
time: 33ms
memory: 12304kb
input:
25 11 9 68 988729312 978893803 906310688 920140739 959394993 998273729 949853986 924816006 990193010 966906539 937746446 937776039 977125396 935068953 909078120 915698548 43064 967374842 961307275 996408546 925562822 931560002 944384977 981282702 922700388 966488914 982858666 953842932 971076445 992...
output:
68 988729312 978893803 906310688 920140739 959394993 998273729 949853986 924816006 990193010 966906539 937746446 937776039 977125396 935068953 909078120 915698548 43064 967374842 961307275 996408546 925562822 931560002 944384977 981282702 922700388 966488914 982858666 953842932 971076445 992872616 9...
result:
ok Correct. (25 test cases)
Test #33:
score: 0
Accepted
time: 474ms
memory: 10244kb
input:
10 10 50 100 260372550 224370653 929271301 767967410 502284101 349384009 202940941 154783885 145644362 966077435 743845691 149769897 507435023 60468873 659673803 389434862 715266673 14605135 188587870 63000907 442355443 785843949 982378871 22199344 584430140 772755653 965473791 989314835 231680916 9...
output:
100 260372550 224370653 929271301 767967410 502284101 349384009 202940941 154783885 145644362 966077435 743845691 149769897 507435023 60468873 659673803 389434862 715266673 14605135 188587870 63000907 442355443 785843949 982378871 22199344 584430140 772755653 965473791 989314835 231680916 945511294 ...
result:
ok Correct. (10 test cases)
Test #34:
score: 0
Accepted
time: 339ms
memory: 12212kb
input:
10 50 10 100 423572185 145436731 764686000 600633655 441415910 169443508 700789417 229288916 127363250 639533552 227845034 620956056 445675721 622306776 556528832 409465277 277492953 36493847 435349083 314519935 612191794 418296475 601945295 813525152 956721741 827242520 676200660 129973732 11311289...
output:
100 423572185 145436731 764686000 600633655 441415910 169443508 700789417 229288916 127363250 639533552 227845034 620956056 445675721 622306776 556528832 409465277 277492953 36493847 435349083 314519935 612191794 418296475 601945295 813525152 956721741 827242520 676200660 129973732 113112898 8339529...
result:
ok Correct. (10 test cases)
Test #35:
score: 0
Accepted
time: 813ms
memory: 10140kb
input:
10 20 25 100 236319064 155794674 339813709 886024917 794289478 901052716 226506117 8788803 911893440 697579614 51349234 667886501 828088943 787487581 742960185 628606808 506112146 537589422 500076754 950636717 5354362 9412365 605409672 56983400 385937164 675984872 539434747 948264769 790467650 43340...
output:
100 236319064 155794674 339813709 886024917 794289478 901052716 226506117 8788803 911893440 697579614 51349234 667886501 828088943 787487581 742960185 628606808 506112146 537589422 500076754 950636717 5354362 9412365 605409672 56983400 385937164 675984872 539434747 948264769 790467650 433400290 8399...
result:
ok Correct. (10 test cases)
Test #36:
score: 0
Accepted
time: 473ms
memory: 10268kb
input:
10 25 20 100 90000254 90000042 90000073 90000730 90000827 90000755 90000252 90000268 90000739 90000086 90000095 90000941 90000949 90000931 90000696 90000502 90000250 90000492 90000583 90000647 90000476 90000372 90000296 90000374 90000595 90000720 90000922 90000985 90000474 90000983 90000381 90000961...
output:
100 90000254 90000042 90000073 90000730 90000827 90000755 90000252 90000268 90000739 90000086 90000095 90000941 90000949 90000931 90000696 90000502 90000250 90000492 90000583 90000647 90000476 90000372 90000296 90000374 90000595 90000720 90000922 90000985 90000474 90000983 90000381 90000961 90000417...
result:
ok Correct. (10 test cases)
Test #37:
score: 0
Accepted
time: 183ms
memory: 10356kb
input:
10 10 50 100 10000 10000 10000 10000 10003 10001 10005 10001 10003 10000 10005 10000 10002 10001 10005 10001 10000 10000 10003 10005 10001 10005 10004 10000 10003 10000 10005 10001 10002 10000 10002 10005 10002 10000 10005 10003 10002 10003 10001 10001 10003 10002 10004 10003 10000 10004 10003 10000...
output:
833 10000 10000 10000 10000 10003 10010 10014 10009 10003 10000 10005 10000 10002 10001 10005 10001 10000 10000 10003 10005 10001 10005 10004 10000 10003 10000 10005 10001 10002 10000 10002 10005 10002 10000 10005 10003 10002 10003 10001 10001 10003 10002 10004 10003 10000 10004 10003 10000 10074 10...
result:
ok Correct. (10 test cases)
Test #38:
score: 0
Accepted
time: 45ms
memory: 10068kb
input:
12 20 20 100 2 1 2 4 3 4 3 5 4 3 5 5 2 1 1 4 3 1 4 1 4 3 2 2 3 3 4 2 5 4 1 1 1 3 3 2 3 1 2 2 1 4 5 3 1 1 1 1 2 3 3 2 2 3 2 4 2 3 2 2 4 5 3 4 2 1 5 5 3 4 1 5 1 3 4 3 1 2 2 2 4 4 5 2 2 5 5 3 1 1 2 5 3 1 2 2 3 2 4 5 3 4 1 2 1 1 4 2 5 1 1 4 2 3 1 3 4 5 5 2 3 4 4 4 5 2 4 5 3 5 4 2 5 5 5 1 2 5 5 1 3 5 4 5...
output:
1637 5 3 2 6 4 4 4 8 4 4 6 5 3 1 2 6 3 2 66 4 5 3 4 4 3 5 7 2 8 5 5 2 1 5 5 2 4 64 5 3 1 7 6 3 4 5 3 5 7 3 4 2 4 5 2 5 64 6 3 2 6 5 3 5 5 1 6 6 3 5 1 6 3 3 4 65 4 4 2 4 6 4 6 5 2 5 6 6 2 2 4 7 3 2 64 5 4 2 6 5 3 5 4 3 4 6 4 3 5 3 4 5 2 65 4 4 4 5 5 2 3 4 4 4 5 2 5 5 4 5 4 2 67 5 5 2 2 5 5 3 3 6 4 5 ...
result:
ok Correct. (12 test cases)
Extra Test:
score: 0
Extra Test Passed