QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#704016 | #125. Wild Boar | TheZone | 100 ✓ | 2130ms | 501220kb | C++20 | 17.9kb | 2024-11-02 19:06:16 | 2024-11-02 19:06:16 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
constexpr int N(2010),M(2010),ML(1e5+10);
using ll=long long;
struct I
{
struct P
{
int a,b;
ll len;
bool operator<(const P &_) const {return len<_.len;}
}ps[5];
int pc;
};
I calc(I::P *ps,int cnt)
{
std::sort(ps,ps+cnt);I ret;if(!cnt){ret.pc=0;return ret;}
ret.ps[(ret.pc=1)-1]=ps[0];
int t1(-1),t2(-1);
for(int i(0);i<cnt;++i) if(ps[i].a!=ps[0].a){ret.ps[ret.pc++]=ps[i];t1=ps[i].b;break;}
for(int i(0);i<cnt;++i) if(ps[i].b!=ps[0].b){ret.ps[ret.pc++]=ps[i];t2=ps[i].a;break;}
if(~t1) for(int i(0);i<cnt;++i) if(ps[i].a!=ps[0].a && ps[i].b!=t1){ret.ps[ret.pc++]=ps[i];break;}
if(~t2) for(int i(0);i<cnt;++i) if(ps[i].b!=ps[0].b && ps[i].a!=t2){ret.ps[ret.pc++]=ps[i];break;}
return ret;
}
I operator+(const I &a,const I &b)
{
static I::P ps[36];int cnt(0);
for(int i(0);i<a.pc;++i) for(int j(0);j<b.pc;++j) if(a.ps[i].b!=b.ps[j].a) ps[cnt++]=(I::P){a.ps[i].a,b.ps[j].b,a.ps[i].len+b.ps[j].len};
return calc(ps,cnt);
}
int n,m;
std::vector<std::pair<int,int>> es[N];
std::pair<int,int> ge[M*2];int wt[M*2];
ll dis[M*2][M*2];I pre[N][N];
void calc(int s)
{
static ll d[M*2];static int vis[N];
constexpr ll inf(1e18);std::fill(d+1,d+m*2+1,inf);std::fill(vis+1,vis+n+1,-1);
d[s]=wt[s];
struct _n
{
ll dis;
int u;
bool operator<(const _n &b) const {return dis>b.dis;}
_n()=default;
_n(ll _d,int _u):dis(_d),u(_u){}
};
static std::priority_queue<_n> q;q.emplace(wt[s],s);
while(!q.empty())
{
auto _=q.top();q.pop();
if(_.dis>d[_.u]) continue;int u(_.u),k(ge[u].second);
if(!(~vis[k]))
{
vis[k]=((u&1)?(u+1):(u-1));
for(auto [id,w]:es[k]) if(d[u]+w<d[id] && id!=vis[k])
{
d[id]=d[u]+w;
q.emplace(d[id],id);
}
}
else if((vis[k]+1)/2!=(u+1)/2)
{
if(d[u]+wt[vis[k]]<d[vis[k]])
{
d[vis[k]]=wt[vis[k]]+d[u];
q.emplace(d[vis[k]],vis[k]);
}
}
}
for(int i(1);i<=m*2;++i) dis[s][i]=d[i];
}
namespace T
{
I z[ML<<2];
void pu(int u){z[u]=z[u<<1]+z[u<<1|1];}
void build(int u,int cl,int cr,int *xs)
{
if(cl==cr){z[u]=pre[xs[cl]][xs[cl+1]];return;}
int mid((cl+cr)>>1);build(u<<1,cl,mid,xs);build(u<<1|1,mid+1,cr,xs);pu(u);
}
void chg(int u,int cl,int cr,int pos,const I &i)
{
if(cl==cr){z[u]=i;return;}int mid((cl+cr)>>1);
if(pos<=mid) chg(u<<1,cl,mid,pos,i);else chg(u<<1|1,mid+1,cr,pos,i);pu(u);
}
}
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int T,L;std::cin>>n>>m>>T>>L;
for(int i(1);i<=m;++i)
{
int u,v,w;std::cin>>u>>v>>w;
es[u].emplace_back(i*2-1,w);es[v].emplace_back(i*2,w);
ge[i*2-1]={u,v};wt[i*2-1]=w;ge[i*2]={v,u};wt[i*2]=w;
}
for(int i(1);i<=m*2;++i) calc(i);
for(int i(1);i<=n;++i) for(int j(1);j<=n;++j) if(j!=i)
{
static I::P ps[M*M];int cnt(0);
for(auto [di,wi]:es[i]) for(auto [dj,wj]:es[j])
{
int t((dj&1)?(dj+1):(dj-1));
ps[cnt++]=(I::P){(di+1)/2,(t+1)/2,dis[di][t]};
}
pre[i][j]=calc(ps,cnt);
}
static int xs[ML];
for(int i(1);i<=L;++i) std::cin>>xs[i];
T::build(1,1,L-1,xs);
while(T--)
{
int pos,v;std::cin>>pos>>v;
xs[pos]=v;
if(pos>1) T::chg(1,1,L-1,pos-1,pre[xs[pos-1]][v]);
if(pos<L) T::chg(1,1,L-1,pos,pre[v][xs[pos+1]]);
if(!T::z[1].pc) std::cout<<"-1\n";
else std::cout<<T::z[1].ps[0].len<<"\n";
}
return 0;
}
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
//☭
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 12
Accepted
Test #1:
score: 12
Accepted
time: 0ms
memory: 13812kb
input:
5 5 1 10 1 4 10 2 4 2 2 5 4 3 5 4 4 5 7 2 4 5 3 5 3 5 4 2 1 10 1
output:
-1
result:
ok single line: '-1'
Test #2:
score: 12
Accepted
time: 2ms
memory: 11824kb
input:
5 10 1 10 1 2 8 1 3 5 1 4 2 1 5 1 2 3 7 2 4 9 2 5 6 3 4 10 3 5 10 4 5 6 4 2 4 3 5 3 1 4 3 5 3 5
output:
64
result:
ok single line: '64'
Test #3:
score: 12
Accepted
time: 1ms
memory: 9720kb
input:
5 10 1 10 1 2 8 1 3 4 1 4 2 1 5 10 2 3 10 2 4 10 2 5 6 3 4 10 3 5 2 4 5 10 5 1 2 1 4 5 1 5 3 1 8 4
output:
60
result:
ok single line: '60'
Test #4:
score: 12
Accepted
time: 2ms
memory: 11840kb
input:
6 10 1 10 1 3 3 1 4 5 1 5 9 1 6 10 2 3 4 2 5 5 2 6 1 3 6 4 4 6 6 5 6 8 4 3 6 4 1 3 6 4 3 5 1 1
output:
48
result:
ok single line: '48'
Test #5:
score: 12
Accepted
time: 0ms
memory: 9868kb
input:
6 10 1 10 1 2 10 1 3 9 1 5 6 1 6 9 2 4 3 2 5 4 2 6 9 3 5 2 4 5 6 4 6 8 4 6 2 3 2 3 1 3 5 4 9 1
output:
86
result:
ok single line: '86'
Test #6:
score: 12
Accepted
time: 0ms
memory: 13880kb
input:
6 10 1 10 1 2 7 1 4 10 1 5 9 1 6 9 2 3 7 2 4 3 3 4 1 3 5 4 4 6 2 5 6 3 6 3 1 3 6 4 6 4 3 1 5 2
output:
61
result:
ok single line: '61'
Test #7:
score: 12
Accepted
time: 2ms
memory: 11896kb
input:
7 10 1 10 1 2 4 1 3 8 1 5 10 1 7 5 2 5 5 2 7 4 3 4 8 3 6 9 4 7 6 5 6 9 2 1 2 1 2 1 2 1 2 1 9 2
output:
56
result:
ok single line: '56'
Test #8:
score: 12
Accepted
time: 2ms
memory: 13872kb
input:
7 10 1 10 1 4 8 1 5 9 1 6 5 1 7 5 2 4 1 2 6 9 2 7 6 3 5 5 3 7 2 5 6 7 6 5 3 4 6 3 6 4 7 4 4 4
output:
88
result:
ok single line: '88'
Test #9:
score: 12
Accepted
time: 1ms
memory: 11852kb
input:
7 10 1 10 1 3 1 1 4 5 1 5 8 2 3 4 2 7 9 3 4 8 3 7 5 4 5 1 5 6 8 6 7 2 6 5 2 5 6 5 6 5 7 6 4 3
output:
84
result:
ok single line: '84'
Test #10:
score: 12
Accepted
time: 0ms
memory: 13896kb
input:
7 10 1 10 1 3 4 1 4 3 1 5 7 1 6 5 1 7 2 2 3 8 2 4 6 4 7 7 5 6 10 6 7 4 3 2 3 1 3 1 3 1 3 2 9 3
output:
90
result:
ok single line: '90'
Test #11:
score: 12
Accepted
time: 2ms
memory: 13968kb
input:
8 10 1 10 1 2 4 1 7 4 1 8 7 2 3 7 2 4 2 3 7 5 3 8 8 4 5 5 5 6 5 6 8 3 3 5 7 5 6 3 5 3 6 4 9 2
output:
105
result:
ok single line: '105'
Test #12:
score: 12
Accepted
time: 1ms
memory: 13960kb
input:
8 10 1 10 1 3 6 1 7 3 1 8 1 2 3 10 2 4 6 2 8 9 3 5 3 4 6 5 5 7 7 6 8 7 5 2 6 8 4 5 2 5 3 6 10 7
output:
114
result:
ok single line: '114'
Test #13:
score: 12
Accepted
time: 1ms
memory: 13952kb
input:
8 10 1 10 1 2 6 1 3 9 1 6 7 2 8 6 3 5 10 4 6 4 4 7 1 4 8 8 5 7 7 6 8 9 2 8 5 6 2 3 5 6 4 8 3 5
output:
125
result:
ok single line: '125'
Test #14:
score: 12
Accepted
time: 1ms
memory: 9776kb
input:
8 10 1 10 1 2 5 1 5 8 1 8 3 2 6 5 2 7 8 3 4 5 3 8 4 4 6 4 5 6 1 5 7 5 7 4 5 1 6 4 7 4 8 6 10 1
output:
99
result:
ok single line: '99'
Test #15:
score: 12
Accepted
time: 0ms
memory: 13832kb
input:
9 10 1 10 1 3 1 1 6 6 1 9 6 2 4 5 2 9 3 3 5 4 4 5 10 6 7 6 7 8 8 8 9 6 3 5 2 6 2 8 5 1 3 7 2 8
output:
189
result:
ok single line: '189'
Test #16:
score: 12
Accepted
time: 1ms
memory: 9784kb
input:
9 10 1 10 1 8 9 1 9 5 2 6 8 2 7 10 3 5 8 3 7 5 4 5 3 4 8 4 5 9 7 6 9 9 4 7 5 2 7 5 8 4 6 1 7 2
output:
217
result:
ok single line: '217'
Test #17:
score: 12
Accepted
time: 0ms
memory: 9808kb
input:
9 10 1 10 1 4 8 1 9 10 2 3 3 2 5 10 3 9 1 4 8 5 5 7 6 6 7 2 6 8 7 8 9 10 2 9 6 4 5 8 6 3 9 3 4 7
output:
116
result:
ok single line: '116'
Test #18:
score: 12
Accepted
time: 1ms
memory: 9808kb
input:
9 10 1 10 1 3 6 1 4 1 2 4 1 2 6 7 3 4 6 3 9 1 5 6 2 5 8 6 7 8 8 7 9 9 1 6 7 6 9 7 1 5 9 3 7 6
output:
155
result:
ok single line: '155'
Test #19:
score: 12
Accepted
time: 2ms
memory: 13900kb
input:
10 10 1 10 1 3 6 1 9 5 2 4 4 2 6 2 3 4 10 5 8 1 5 10 7 6 7 8 7 10 2 8 9 8 10 3 10 9 1 2 8 4 7 4 2 3
output:
196
result:
ok single line: '196'
Test #20:
score: 12
Accepted
time: 1ms
memory: 9864kb
input:
10 10 1 10 1 4 5 1 8 6 2 8 9 2 9 7 3 9 4 3 10 3 4 7 5 5 6 10 5 10 10 6 7 8 9 5 4 6 5 8 2 8 9 8 3 9
output:
284
result:
ok single line: '284'
Test #21:
score: 12
Accepted
time: 1ms
memory: 9736kb
input:
5 10 1 10 1 2 1 1 3 7 1 4 6 1 5 10 2 3 2 2 4 4 2 5 5 3 4 1 3 5 10 4 5 3 2 1 5 1 4 2 5 4 1 5 7 5
output:
45
result:
ok single line: '45'
Test #22:
score: 12
Accepted
time: 0ms
memory: 13820kb
input:
5 10 1 10 1 2 4 1 3 10 1 4 5 1 5 6 2 3 2 2 4 1 2 5 1 3 4 9 3 5 10 4 5 10 4 2 3 1 4 3 1 3 2 3 10 1
output:
49
result:
ok single line: '49'
Test #23:
score: 12
Accepted
time: 0ms
memory: 9736kb
input:
5 10 1 10 1 2 10 1 3 8 1 4 2 1 5 10 2 3 7 2 4 2 2 5 4 3 4 3 3 5 7 4 5 1 3 1 2 4 5 4 3 2 5 2 10 2
output:
41
result:
ok single line: '41'
Test #24:
score: 12
Accepted
time: 1ms
memory: 11792kb
input:
5 10 1 10 1 2 7 1 3 7 1 4 4 1 5 8 2 3 6 2 4 10 2 5 1 3 4 9 3 5 4 4 5 6 1 4 3 1 2 4 2 1 2 4 1 2
output:
70
result:
ok single line: '70'
Test #25:
score: 12
Accepted
time: 1ms
memory: 9792kb
input:
5 10 1 10 1 2 10 1 3 8 1 4 9 1 5 3 2 3 3 2 4 3 2 5 10 3 4 1 3 5 1 4 5 7 4 3 1 3 4 2 4 5 2 3 9 2
output:
36
result:
ok single line: '36'
Test #26:
score: 12
Accepted
time: 1ms
memory: 11832kb
input:
5 10 1 10 1 2 5 1 3 7 1 4 2 1 5 6 2 3 5 2 4 2 2 5 8 3 4 8 3 5 3 4 5 1 3 2 5 4 1 2 4 3 1 2 2 2
output:
38
result:
ok single line: '38'
Subtask #2:
score: 35
Accepted
Dependency #1:
100%
Accepted
Test #27:
score: 35
Accepted
time: 2ms
memory: 13900kb
input:
20 40 1 100 1 9 61 1 17 2 1 20 2 2 8 35 2 16 11 2 17 4 3 5 19 3 18 52 4 5 4 4 6 89 4 11 52 5 6 59 5 10 77 5 12 24 5 13 82 5 16 55 5 18 25 6 7 98 6 9 59 6 15 37 7 10 42 7 17 71 8 10 37 8 19 31 9 10 74 9 14 25 9 15 70 9 18 39 10 14 1 11 20 46 12 17 48 12 20 36 13 17 32 13 20 77 14 18 73 15 16 50 15 17...
output:
8152
result:
ok single line: '8152'
Test #28:
score: 35
Accepted
time: 3ms
memory: 56912kb
input:
100 100 1 100000 1 8 471117256 1 62 130027795 1 73 656848900 2 37 768343489 2 79 60152578 3 39 730756132 3 91 742436424 4 14 127206074 4 26 49752186 4 37 277130591 5 39 267794148 5 67 795814790 6 26 322818374 7 9 528203057 7 22 321028016 7 74 603723430 8 48 173910965 9 56 146180110 9 84 468273541 9 ...
output:
-1
result:
ok single line: '-1'
Test #29:
score: 35
Accepted
time: 10ms
memory: 54792kb
input:
100 100 1 100000 1 22 496690411 1 80 160170813 2 78 246401127 2 79 698301891 3 18 335424010 3 43 199212643 4 8 387887272 5 63 342214421 5 89 493693783 6 12 43866762 7 25 965696870 8 67 293983530 9 71 213899161 10 93 733230250 10 97 886418929 11 28 387081262 11 62 181334144 12 27 278789468 12 49 7986...
output:
-1
result:
ok single line: '-1'
Test #30:
score: 35
Accepted
time: 63ms
memory: 69300kb
input:
100 300 1 100000 1 5 365304469 1 9 179648504 1 34 59704152 1 46 817333375 2 5 583565204 2 9 785103102 2 40 480198908 2 47 835927550 2 48 354380031 2 65 486715288 2 92 950313228 2 93 374483314 3 30 82337560 3 32 308293283 3 60 646076359 3 97 197337851 4 16 366616801 4 18 585876058 4 29 61422451 4 41 ...
output:
93114286907830
result:
ok single line: '93114286907830'
Test #31:
score: 35
Accepted
time: 63ms
memory: 67232kb
input:
100 300 1 100000 1 3 912986539 1 9 197792176 1 13 246835129 1 16 344867075 1 18 967911416 1 19 441622270 1 22 775263613 1 29 968144880 1 34 820331077 1 36 757601901 1 51 502350836 1 63 474234541 1 64 113420408 1 66 153943653 1 67 199823271 1 72 138370407 1 82 774858096 1 83 139129019 1 90 916684302 ...
output:
35572091890278
result:
ok single line: '35572091890278'
Test #32:
score: 35
Accepted
time: 53ms
memory: 64884kb
input:
100 300 1 100000 1 2 314864312 1 3 280386699 1 5 900829806 1 6 286123321 1 7 662490056 1 8 717445306 1 9 388158739 1 15 820246487 1 17 380616676 1 19 118295437 1 20 278592968 1 21 38694483 1 23 405950418 1 27 271185615 1 28 124119023 1 31 138766045 1 35 4292030 1 36 699435130 1 38 115953700 1 39 635...
output:
12727469493056
result:
ok single line: '12727469493056'
Test #33:
score: 35
Accepted
time: 31ms
memory: 69304kb
input:
100 300 1 100000 1 2 523087200 1 3 8625758 1 4 479922033 1 5 179521367 1 6 52560042 1 7 647680332 1 8 10574482 1 9 420818013 1 10 443941068 1 11 265762494 1 12 880093987 1 13 984518118 1 14 551970324 1 15 328833026 1 16 906486091 1 17 985112084 1 18 478403683 1 21 344890629 1 23 180458589 1 25 23751...
output:
6812101494149
result:
ok single line: '6812101494149'
Test #34:
score: 35
Accepted
time: 62ms
memory: 75568kb
input:
150 300 1 100000 1 57 878207960 1 93 703334538 1 101 68840341 2 9 609874540 2 14 524137107 2 30 948045570 2 38 438159917 2 98 989192311 3 42 257559234 3 75 152187092 3 148 440131087 4 28 567615969 4 46 776359152 4 54 179042810 4 125 426404592 5 50 265179533 5 66 877325657 5 75 700145090 5 99 1205793...
output:
156796709032107
result:
ok single line: '156796709032107'
Test #35:
score: 35
Accepted
time: 47ms
memory: 77368kb
input:
150 300 1 100000 1 16 202605724 1 34 111505563 1 76 802050519 1 95 522857534 1 97 217611266 1 124 553211647 2 84 23122883 2 106 665133149 3 83 800041101 3 89 488010281 3 142 376710381 3 148 559320220 4 7 338847173 4 26 682077064 4 36 501041950 4 58 301859723 4 62 257257630 4 68 394915954 4 131 73298...
output:
158718457185257
result:
ok single line: '158718457185257'
Test #36:
score: 35
Accepted
time: 35ms
memory: 75368kb
input:
150 300 1 100000 1 2 131562815 1 3 383393237 1 5 252538693 1 7 236824663 1 8 689269584 1 10 247469848 1 11 461280494 1 12 598561583 1 15 183046296 1 17 586816553 1 18 896988909 1 19 388930811 1 20 420628667 1 21 768353228 1 24 880805200 1 25 469471039 1 27 177584827 1 30 1802821 1 32 1752197 1 35 56...
output:
12477242437185
result:
ok single line: '12477242437185'
Test #37:
score: 35
Accepted
time: 42ms
memory: 75380kb
input:
150 300 1 100000 1 3 397335916 1 9 149871467 1 11 906429160 1 12 907834891 1 13 95045117 1 15 123378294 1 19 130873916 1 20 784547300 1 23 579232016 1 24 692840149 1 25 429494420 1 29 256646966 1 30 25479873 1 33 98932677 1 35 747188673 1 39 24829208 1 40 655452971 1 42 859426866 1 46 619182596 1 47...
output:
35395680659889
result:
ok single line: '35395680659889'
Test #38:
score: 35
Accepted
time: 53ms
memory: 75420kb
input:
150 300 1 100000 1 42 727058849 1 49 349708043 1 57 999809570 1 88 336747661 2 8 587959218 2 31 588457404 3 94 829049410 3 98 102020218 3 144 187783209 3 149 182448561 4 55 89240698 4 75 832327090 4 100 34796121 5 8 936264949 5 61 710383076 5 77 556268363 5 101 23917938 6 50 600701047 6 82 262234386...
output:
153201692683735
result:
ok single line: '153201692683735'
Test #39:
score: 35
Accepted
time: 40ms
memory: 63700kb
input:
200 300 1 100000 1 19 909805577 1 97 582775452 2 27 43163990 2 30 442296779 2 66 878591352 2 89 513837579 2 151 277200957 3 64 985251429 3 79 641905693 3 133 215658546 4 34 748196928 4 174 11100110 4 189 225851894 5 136 24998123 5 150 416236971 5 177 571026362 6 28 147828956 6 58 678254484 6 79 9310...
output:
255201255583268
result:
ok single line: '255201255583268'
Test #40:
score: 35
Accepted
time: 43ms
memory: 83908kb
input:
200 300 1 100000 1 11 50543344 1 26 175124937 1 29 726988619 1 30 489727785 1 41 707658243 1 47 64703458 1 50 222132616 1 51 278508318 1 52 495534006 1 56 449020704 1 63 303036406 1 73 356701920 1 83 898919082 1 89 767068839 1 94 894349166 1 100 57693820 1 108 31975726 1 112 232178142 1 117 61458064...
output:
53584398972763
result:
ok single line: '53584398972763'
Test #41:
score: 35
Accepted
time: 59ms
memory: 83628kb
input:
200 300 1 100000 1 32 792158817 1 137 25487399 1 155 772268784 2 63 941831574 2 98 105568022 2 156 239332109 3 92 253866448 3 122 672259455 4 9 713111912 4 19 598402833 4 30 820316864 4 114 680217866 4 152 424095465 5 48 68970188 5 143 24731629 5 156 770600892 6 119 588905532 6 133 82848267 7 38 167...
output:
267939841388462
result:
ok single line: '267939841388462'
Test #42:
score: 35
Accepted
time: 43ms
memory: 82140kb
input:
200 300 1 100000 1 22 535223654 1 142 603041735 1 186 192207208 2 44 367710248 2 55 79901099 2 134 986616264 2 182 726190801 2 193 614388294 3 28 689728406 3 71 854707789 3 100 420300867 4 51 684428208 4 85 157443457 4 94 844010383 4 118 273611275 4 200 149184217 5 29 695523255 5 52 946678086 5 61 3...
output:
268285977186522
result:
ok single line: '268285977186522'
Test #43:
score: 35
Accepted
time: 32ms
memory: 82572kb
input:
230 300 1 100000 1 2 742794410 1 3 728150284 1 20 401244033 1 21 70310741 1 34 667555409 1 36 594171145 1 42 544498443 1 61 257894401 1 84 687337304 1 85 965200707 1 86 807054423 1 93 963823263 1 99 443314390 1 107 31267844 1 108 547633577 1 111 556970671 1 118 213208555 1 125 840297483 1 129 958611...
output:
77172557277251
result:
ok single line: '77172557277251'
Test #44:
score: 35
Accepted
time: 37ms
memory: 90060kb
input:
250 300 1 100000 1 49 326167568 1 92 930782713 2 37 160107383 2 237 551533701 3 53 917311888 3 152 600286392 4 112 737862953 4 126 372037561 5 150 129855862 5 237 978322168 6 244 595435111 6 250 476977898 7 11 514404625 7 84 157813656 8 89 111824040 8 204 121230607 9 119 495099315 9 133 136354536 10...
output:
465520766059970
result:
ok single line: '465520766059970'
Test #45:
score: 35
Accepted
time: 42ms
memory: 83480kb
input:
250 300 1 100000 1 23 151374420 1 200 605870388 2 180 472093518 2 195 765657780 2 237 771384939 3 25 369658311 3 38 603813994 3 139 427985331 4 23 767911031 4 45 556624664 4 87 128653888 5 20 730849760 5 92 226785250 5 153 905678103 6 68 334063497 6 111 673737490 6 160 783223392 7 66 918450016 7 122...
output:
479631977494206
result:
ok single line: '479631977494206'
Test #46:
score: 35
Accepted
time: 25ms
memory: 90156kb
input:
300 300 1 100000 1 61 987580639 1 132 274493980 2 137 135288592 2 230 869989040 3 78 757256421 3 180 679335221 4 7 306075219 4 69 816734920 5 128 626849350 5 283 709406225 6 57 72516811 6 230 104732523 7 252 57223906 8 148 780817506 8 217 209842564 9 68 133059571 9 117 456949134 10 33 787824292 10 3...
output:
7275932816495946
result:
ok single line: '7275932816495946'
Subtask #3:
score: 15
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #47:
score: 15
Accepted
time: 69ms
memory: 66740kb
input:
200 500 1 50 1 11 34 1 32 97 1 43 30 1 55 96 1 89 88 1 92 51 1 108 16 1 121 86 2 45 64 2 51 8 2 62 60 2 73 44 2 100 74 2 117 70 2 128 15 2 178 31 2 181 5 2 189 21 3 5 77 3 166 99 4 23 6 4 33 37 4 140 42 4 198 67 5 35 38 5 39 60 5 77 38 5 109 51 6 41 2 6 86 72 6 97 66 6 116 39 6 133 42 6 147 12 6 160...
output:
5847
result:
ok single line: '5847'
Test #48:
score: 15
Accepted
time: 1427ms
memory: 178752kb
input:
500 2000 1 100000 1 2 799202998 1 3 70814651 1 4 166275349 1 5 551769444 1 7 461096012 1 8 534263628 1 9 151173730 1 10 221493187 1 11 838959315 1 12 761142835 1 13 280847539 1 14 896759219 1 15 754519641 1 17 171545812 1 19 50980387 1 21 67949479 1 22 786655275 1 23 649900813 1 26 770954979 1 27 21...
output:
6260410251443
result:
ok single line: '6260410251443'
Test #49:
score: 15
Accepted
time: 1318ms
memory: 214328kb
input:
800 2000 1 100000 1 2 157655669 1 4 446875712 1 6 808513252 1 7 472781188 1 10 982637200 1 11 947266908 1 12 699315534 1 16 917785011 1 18 136547621 1 19 250495719 1 20 704288203 1 21 632177911 1 25 662352820 1 27 593914743 1 28 418593433 1 37 966961557 1 40 424284254 1 42 77342498 1 43 930525301 1 ...
output:
8915394679509
result:
ok single line: '8915394679509'
Test #50:
score: 15
Accepted
time: 1350ms
memory: 246180kb
input:
1000 2000 1 100000 1 2 43852398 1 4 998331786 1 5 300298846 1 6 898256294 1 7 561869420 1 12 427770772 1 16 144859407 1 20 474895449 1 22 737471836 1 28 400459485 1 29 119781325 1 31 866262817 1 33 442263306 1 34 973833212 1 37 280414788 1 42 456644193 1 44 143876334 1 52 601989530 1 60 289694925 1 ...
output:
20910390822664
result:
ok single line: '20910390822664'
Test #51:
score: 15
Accepted
time: 1313ms
memory: 245464kb
input:
1000 2000 1 100000 1 3 80139289 1 5 694390674 1 12 281351538 1 19 218941977 1 20 781420637 1 22 83740959 1 31 53795060 1 32 364432226 1 33 224860380 1 34 183746897 1 49 756786619 1 60 677808436 1 61 481907479 1 66 185098737 1 69 237903106 1 70 792522463 1 71 521669135 1 75 425602948 1 77 384108521 1...
output:
11915895659094
result:
ok single line: '11915895659094'
Test #52:
score: 15
Accepted
time: 1280ms
memory: 245248kb
input:
1000 2000 1 100000 1 9 373112932 1 12 492765708 1 13 760131920 1 17 865389518 1 19 148453513 1 24 877280379 1 26 612591153 1 28 176497954 1 29 750685211 1 30 807441139 1 35 886076004 1 40 14700143 1 42 669637100 1 43 751249546 1 44 86823878 1 46 654427170 1 47 380290294 1 49 608820075 1 50 715504409...
output:
8073476690431
result:
ok single line: '8073476690431'
Test #53:
score: 15
Accepted
time: 1233ms
memory: 245712kb
input:
1000 2000 1 100000 1 146 265539242 1 787 717806900 2 99 561024983 2 169 107802796 2 785 829863913 2 908 823173936 3 395 682748856 3 605 892930129 3 688 666831100 3 822 261525980 4 49 559136539 4 81 804262295 4 671 66923572 4 988 95129764 5 153 457428795 5 446 608860803 5 461 205883700 5 488 13976357...
output:
202357340046894
result:
ok single line: '202357340046894'
Test #54:
score: 15
Accepted
time: 1245ms
memory: 243332kb
input:
1000 2000 1 100000 1 189 61544008 1 202 833875544 1 382 488985253 1 791 788764390 2 251 249163022 2 266 774363438 2 718 332703034 3 360 885118875 3 547 364974317 3 564 430424783 3 628 364170814 4 418 901229360 4 908 631145277 4 924 259640666 5 492 377251143 5 852 746602647 5 950 587205889 6 278 5408...
output:
206504918353028
result:
ok single line: '206504918353028'
Test #55:
score: 15
Accepted
time: 1248ms
memory: 244724kb
input:
1000 2000 1 100000 1 33 929637740 1 75 314877121 1 138 595420872 1 233 254859751 1 656 726999907 2 108 631045151 2 209 997704061 2 437 745202445 2 654 184933128 3 223 609597986 3 422 841134009 4 467 219314329 4 683 814689784 5 48 258724221 5 409 571452027 5 671 228089274 5 729 406155949 5 977 315180...
output:
200417247718197
result:
ok single line: '200417247718197'
Test #56:
score: 15
Accepted
time: 1242ms
memory: 245204kb
input:
1000 2000 1 100000 1 767 430895017 1 797 267085094 1 973 622445896 2 296 79132601 2 479 50554076 2 523 334478127 2 672 231873549 2 679 129843346 2 742 570837413 2 887 385332205 3 146 269967303 3 198 545188271 3 228 565599702 3 392 932969710 4 571 999759097 4 612 676610647 4 654 623927938 4 746 92855...
output:
204182375564076
result:
ok single line: '204182375564076'
Test #57:
score: 15
Accepted
time: 1226ms
memory: 264580kb
input:
1100 2000 1 100000 1 158 637074501 1 710 801051626 1 711 367839843 2 394 125561622 2 469 753634911 2 477 903083519 2 582 51405118 2 805 194609222 2 1035 605598466 3 139 331028746 3 223 676486992 3 265 724513122 3 598 977792611 3 750 361496304 4 494 21948003 4 772 995462320 5 183 427259770 5 530 7804...
output:
234310995770405
result:
ok single line: '234310995770405'
Test #58:
score: 15
Accepted
time: 1200ms
memory: 283848kb
input:
1200 2000 1 100000 1 45 151494925 1 682 648656677 1 908 414659342 1 1016 180092461 2 679 85708627 2 935 531780507 3 202 436578842 3 493 608617128 3 580 597384984 3 674 19517914 3 916 758869724 3 946 803680525 4 144 639968873 4 415 75434207 4 483 287746137 5 7 935028002 5 883 532965939 5 977 54459873...
output:
269372989829770
result:
ok single line: '269372989829770'
Test #59:
score: 15
Accepted
time: 1199ms
memory: 305516kb
input:
1300 2000 1 100000 1 223 392856121 1 251 988204834 1 266 191975770 1 1101 867087024 2 419 964619471 2 536 717781131 3 475 471335293 3 624 772971819 3 864 446100456 4 246 817374327 4 330 862505744 4 1183 432822797 5 174 280870091 5 1232 318738592 6 376 818047549 6 1263 868069815 7 32 730357755 7 617 ...
output:
310833304137352
result:
ok single line: '310833304137352'
Test #60:
score: 15
Accepted
time: 1210ms
memory: 327820kb
input:
1400 2000 1 100000 1 519 148871372 1 626 135017978 1 1018 311404266 1 1293 569095501 2 244 39379604 2 559 173787504 2 602 549225069 3 408 745467718 3 968 328583573 4 458 200860996 4 617 567811912 5 603 802582193 5 755 426514096 5 1041 949791055 5 1222 575741188 6 680 436418752 6 1275 370759373 7 263...
output:
376566604923396
result:
ok single line: '376566604923396'
Test #61:
score: 15
Accepted
time: 1126ms
memory: 354768kb
input:
1500 2000 1 100000 1 33 526554653 1 210 761496655 1 1104 208216601 2 345 42001698 2 491 661745186 3 1317 158328332 3 1416 749606015 4 822 693343634 4 843 384433391 5 912 212780833 5 1063 669130099 6 299 850466423 6 864 906431506 6 1268 19276072 7 282 710707542 7 993 183112457 8 603 150241498 8 774 7...
output:
458407341914078
result:
ok single line: '458407341914078'
Test #62:
score: 15
Accepted
time: 1107ms
memory: 380296kb
input:
1600 2000 1 100000 1 985 854841087 1 1017 266804611 2 1201 609703497 2 1332 482417893 2 1450 970392724 3 337 945242535 3 947 464154808 4 318 117668664 4 393 442342159 4 1089 18044226 5 33 213672536 5 1124 131475550 5 1218 290844477 6 334 503456759 6 468 38229989 7 458 940244814 7 1591 884854788 8 12...
output:
530052270631724
result:
ok single line: '530052270631724'
Test #63:
score: 15
Accepted
time: 1077ms
memory: 410564kb
input:
1700 2000 1 100000 1 576 862037604 1 1189 678849245 1 1273 717325711 1 1337 609356680 1 1459 997427218 2 172 903345156 2 874 191796681 3 1555 738444242 3 1600 339240620 4 748 447350463 4 1489 168143773 5 214 88025905 5 657 7295054 6 193 183309142 6 1159 553302939 7 1629 579349540 7 1689 534075287 8 ...
output:
698028432533845
result:
ok single line: '698028432533845'
Test #64:
score: 15
Accepted
time: 991ms
memory: 441024kb
input:
1800 2000 1 100000 1 496 892547386 1 812 528881635 2 566 632443282 2 1437 138577557 3 755 81394128 3 1627 480232269 4 16 456204401 4 1259 841014721 5 462 397926678 5 1383 776538144 6 51 124625414 6 1074 576608956 7 565 58701272 7 1305 123890496 8 1271 248799423 8 1686 603850241 9 118 243035053 9 154...
output:
1005496863510461
result:
ok single line: '1005496863510461'
Test #65:
score: 15
Accepted
time: 429ms
memory: 498916kb
input:
2000 2000 1 100000 1 1297 145010449 1 1451 709684521 2 1777 703537272 2 1883 655550186 3 909 635782270 3 1137 954354936 4 8 260474719 4 1972 804193154 5 139 150768703 5 1118 575210945 6 522 165247783 6 1059 205797802 7 295 911581510 7 359 332372682 8 126 128591703 9 1280 381287018 9 1360 576864790 1...
output:
48367867260844863
result:
ok single line: '48367867260844863'
Test #66:
score: 15
Accepted
time: 445ms
memory: 498708kb
input:
2000 2000 1 100000 1 468 618113821 1 835 172940688 2 940 769098252 2 1058 802227358 3 1405 915334495 3 1566 764903283 4 641 808779005 4 1777 698210047 5 298 357942478 5 829 276145193 6 635 51027656 6 1790 34075486 7 263 449378656 7 1542 740653110 8 632 651885025 8 1666 977131526 9 239 284584144 9 12...
output:
47843251504395645
result:
ok single line: '47843251504395645'
Subtask #4:
score: 38
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #67:
score: 38
Accepted
time: 29ms
memory: 37752kb
input:
20 40 100 100000 1 6 987 1 11 783 2 3 25 2 4 228 2 7 11 2 9 803 2 18 330 3 15 926 3 17 258 4 11 809 4 14 948 4 16 540 5 10 861 5 14 832 6 9 502 6 12 687 6 17 336 6 20 388 7 14 954 7 20 113 8 11 587 8 13 407 8 16 605 8 20 329 9 10 449 9 11 440 9 13 432 9 16 789 10 16 86 11 15 252 11 16 349 11 17 892 ...
output:
107301632 107302149 107303013 107301244 107302691 107302951 107304338 107304338 107304846 107303692 107305412 107304754 107304236 107303329 107303329 107303329 107303993 107302638 107304665 107304665 107304568 107302231 107304099 107305036 107304575 107304296 107306324 107306227 107306227 107306179 ...
result:
ok 100 lines
Test #68:
score: 38
Accepted
time: 156ms
memory: 150304kb
input:
1000 1000 100000 100 1 742 707 2 829 519 3 336 990 4 720 747 5 286 427 5 773 720 6 19 838 6 201 475 6 711 58 6 983 299 7 536 660 8 235 219 8 913 56 9 195 694 9 350 253 10 200 201 10 253 174 10 573 640 10 869 279 11 508 123 11 886 810 12 838 926 13 369 704 13 539 46 13 689 869 14 488 484 14 539 204 1...
output:
-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 ...
result:
ok 100000 lines
Test #69:
score: 38
Accepted
time: 343ms
memory: 478508kb
input:
2000 2000 100 100 1 515 666448701 1 1649 401098309 2 640 673004164 2 1167 33862589 2 1616 878538685 3 625 895349391 4 137 298302337 4 529 112653749 5 8 635484125 5 888 297855613 6 1108 224194833 7 160 949536424 9 233 413793897 10 1732 920527660 11 1403 612800874 12 166 277916402 12 872 391982103 12 ...
output:
-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
result:
ok 100 lines
Test #70:
score: 38
Accepted
time: 442ms
memory: 476316kb
input:
2000 2000 100000 100 1 1435 253445557 2 631 777646389 2 1284 186676412 3 1301 91918649 3 1877 927193900 4 284 888629880 5 723 67489022 5 1114 258850137 5 1674 499297658 5 1996 413672729 6 296 972959491 6 1437 630485632 7 1910 133683202 8 308 682674983 8 447 384301247 8 887 852962869 8 931 874976511 ...
output:
-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 ...
result:
ok 100000 lines
Test #71:
score: 38
Accepted
time: 483ms
memory: 500456kb
input:
2000 2000 100000 100000 1 1835 815996124 1 1927 608300753 2 931 362028647 3 71 430265560 3 846 594795523 3 946 168542632 4 90 321492297 4 1896 132057014 5 968 260169013 5 1082 44612095 5 1426 770836502 6 690 474171960 7 1066 990178722 8 1245 149242691 9 431 824468570 9 476 395470089 9 1056 281805333...
output:
-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 ...
result:
ok 100000 lines
Test #72:
score: 38
Accepted
time: 2130ms
memory: 178468kb
input:
500 2000 100000 100000 1 2 797279819 1 3 396668877 1 4 296077915 1 6 494595090 1 7 55792672 1 8 324776562 1 9 214135792 1 11 624900642 1 13 254906979 1 17 908611552 1 19 673124924 1 20 617627682 1 21 207404085 1 22 317273834 1 23 593047669 1 25 231303314 1 27 983833690 1 28 502882158 1 29 554792402 ...
output:
8287405792922 8287342955203 8287414097952 8287414097952 8287477362531 8287481998593 8287375870894 8287411130255 8287385865008 8287349905484 8287385865008 8287447089779 8287366513390 8287366513390 8287366513390 8287397136689 8287348222253 8287348222253 8287348222253 8287317598954 8287226416410 828711...
result:
ok 100000 lines
Test #73:
score: 38
Accepted
time: 1981ms
memory: 213076kb
input:
800 2000 100000 100000 1 3 100873752 1 4 409308335 1 6 886856384 1 8 976108500 1 10 47495278 1 12 588618523 1 14 99142041 1 24 702152131 1 25 695837981 1 26 952503433 1 30 877928200 1 36 183334300 1 37 238006668 1 40 916832921 1 42 795045246 1 43 351841554 1 44 734375212 1 48 899063330 1 58 33443759...
output:
9729839538401 9729937027878 9729937027878 9729937027878 9729937027878 9729937027878 9729937027878 9729937027878 9729897879722 9729824187182 9729823723816 9729897267581 9729897267581 9729897267581 9729897267581 9729897267581 9729883730348 9729784881435 9729809204106 9729810563542 9729810563542 972977...
result:
ok 100000 lines
Test #74:
score: 38
Accepted
time: 1840ms
memory: 244828kb
input:
1000 2000 100000 100000 1 688 931048703 1 841 263034692 2 415 858386667 2 513 999388450 2 600 151806135 2 718 974125772 2 908 553371349 3 334 604805876 3 649 796640325 3 699 172511958 3 890 154865264 4 470 840701224 4 580 216589880 4 659 34793149 4 706 143235295 5 135 427093557 5 209 241210993 5 336...
output:
198062313162003 198064164915236 198062278715050 198062827123908 198063122223590 198063658362845 198064987163594 198064888480392 198063780324621 198064685421108 198063671221560 198065629773232 198066785252482 198066592086539 198067744789902 198067940779327 198067887427964 198067235705495 198068696832...
result:
ok 100000 lines
Test #75:
score: 38
Accepted
time: 1839ms
memory: 260488kb
input:
1000 2000 100000 100000 1 24 704490046 1 191 172163826 1 245 498018736 1 519 268016095 1 703 444207325 1 893 303562845 1 945 176890075 2 226 755700185 2 300 757503428 2 607 516875775 2 877 552573131 2 950 509666510 3 183 396684860 3 616 526923203 3 928 469024767 4 338 681077036 4 433 56004250 4 612 ...
output:
196351948334779 196350987297144 196350888663843 196351382587725 196351079700975 196351718870237 196351947287969 196350051048331 196351682173050 196350542339527 196349427557932 196349139515367 196349926996017 196350292842497 196349767115956 196349350490190 196348924471360 196347110542957 196345478743...
result:
ok 100000 lines
Test #76:
score: 38
Accepted
time: 1832ms
memory: 259752kb
input:
1000 2000 100000 100000 1 291 218930776 1 778 999973660 2 684 671054877 2 858 393556331 3 560 589411239 3 578 765046373 4 879 144742557 4 971 243744598 5 498 380253897 5 656 729930858 5 763 996163223 6 228 691875669 6 275 114142850 6 305 293670673 6 368 72818064 6 676 88213552 6 813 875306471 7 159 ...
output:
202114590661636 202118049340145 202117049134180 202117023409512 202117606551455 202117027633036 202118546360152 202119293531454 202119921900347 202119432041326 202120084899164 202119389169695 202117494613719 202117424613229 202116655337409 202117425467957 202115275734981 202114413179391 202113949649...
result:
ok 100000 lines
Test #77:
score: 38
Accepted
time: 1977ms
memory: 260284kb
input:
1000 2000 100000 100000 1 2 445966640 1 3 29306026 1 6 26333011 1 9 122723253 1 11 289392210 1 12 517999099 1 15 760366748 1 25 513164141 1 34 679937403 1 35 291463072 1 37 123674469 1 42 632070792 1 47 961966667 1 52 716339436 1 54 884212685 1 64 100007026 1 70 695352161 1 73 995191826 1 78 9117943...
output:
13766056353871 13765778532502 13765487141608 13765487141608 13765487141608 13765421984731 13765421984731 13765211354959 13765133062056 13765424452950 13765236665208 13765295344290 13765295344290 13765295344290 13765237526413 13765299862287 13765299862287 13765299862287 13765396463319 13765396463319 ...
result:
ok 100000 lines
Test #78:
score: 38
Accepted
time: 1769ms
memory: 263272kb
input:
1000 2000 100000 100000 1 2 880495081 1 3 840224417 1 6 976072543 1 11 268563947 1 14 172406352 1 16 872222861 1 19 587615599 1 24 648981416 1 25 171143979 1 26 840779196 1 29 564366347 1 31 483177683 1 34 470907495 1 36 474862415 1 38 48056318 1 41 206895967 1 42 212789359 1 46 738701027 1 49 26312...
output:
12019663471641 12019446446733 12019446446733 12019433901539 12019433901539 12019433901539 12019433901539 12019433901539 12019433901539 12019433901539 12019433901539 12019433901539 12019446446733 12019676016835 12019676016835 12019676016835 12019676016835 12019676016835 12019905586937 12019905586937 ...
result:
ok 100000 lines
Test #79:
score: 38
Accepted
time: 1583ms
memory: 264264kb
input:
1000 2000 100000 100000 1 2 795716816 1 3 145867882 1 4 140221078 1 5 954436454 1 6 596766163 1 10 468921059 1 12 119637765 1 13 775579007 1 15 778887978 1 16 32713056 1 18 696177704 1 20 395582824 1 24 906930161 1 25 688824680 1 26 940005369 1 29 684761724 1 35 679497427 1 38 964970599 1 39 2570566...
output:
6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 6384674926823 638467...
result:
ok 100000 lines
Test #80:
score: 38
Accepted
time: 1739ms
memory: 299152kb
input:
1200 2000 100000 100000 1 249 424865294 1 333 898426964 1 1178 86795923 2 37 882467885 2 744 864373930 2 891 165039314 3 22 695113220 3 230 533565984 3 318 903208403 3 747 579833705 3 792 933303157 4 488 430740351 4 1034 911184330 4 1191 960444239 5 16 693152022 5 320 227241943 5 384 266233807 5 442...
output:
262569428795986 262568155504918 262568199149401 262568467615986 262568603742775 262569068621796 262569691873338 262568461997746 262566876837893 262563738864398 262563983054326 262561099187667 262562110800577 262564702307572 262566418266158 262564248994465 262562473742847 262563710480111 262560868827...
result:
ok 100000 lines
Test #81:
score: 38
Accepted
time: 1722ms
memory: 317716kb
input:
1300 2000 100000 100000 1 773 264944874 1 1056 698984105 2 168 959365223 2 200 625644622 2 284 716954036 2 421 202359741 2 666 383664678 3 469 511723215 3 628 347868608 3 923 787562671 3 947 106638516 4 30 183971613 4 919 387150331 5 86 351728804 5 598 520164165 5 649 28972673 5 928 831804037 5 1238...
output:
314505600907080 314507709787853 314508209065653 314509082521333 314509720869278 314509626801696 314509908167517 314512399841158 314514783596899 314516142380819 314520325485456 314519984967566 314522131560382 314519652395069 314521392792574 314522829781730 314521532872899 314520046389366 314519766189...
result:
ok 100000 lines
Test #82:
score: 38
Accepted
time: 1704ms
memory: 339688kb
input:
1400 2000 100000 100000 1 13 617550130 1 18 675858614 1 26 739431870 1 29 629028255 1 37 705241745 1 39 148210659 1 50 610508568 1 55 766217862 1 56 15546826 1 61 444080636 1 68 482100477 1 69 159853510 1 74 137394987 1 94 960436531 1 97 741041751 1 106 257111599 1 123 961372019 1 131 607118052 1 14...
output:
16287689356499 16287689356499 16287689356499 16287689356499 16287689356499 16287689356499 16287983473467 16287689356499 16287395239531 16287689356499 16287689356499 16287689356499 16287689356499 16287689356499 16287689356499 16287689356499 16287689356499 16287983473467 16287983473467 16287983473467 ...
result:
ok 100000 lines
Test #83:
score: 38
Accepted
time: 1647ms
memory: 359732kb
input:
1500 2000 100000 100000 1 464 902710675 1 639 633748508 1 1065 6470291 2 214 945209021 2 994 684772299 2 1037 734457403 2 1459 139342107 3 739 856664450 3 1126 263463749 4 35 512616018 4 984 467949558 5 490 122591647 5 560 784937838 5 620 185719385 5 1203 237691970 6 266 555201652 6 648 116354291 6 ...
output:
440056305375691 440057052502784 440057742144106 440057694056860 440051389043077 440051662252573 440054745483929 440056744007886 440053045145283 440049592289116 440055352039857 440054017944359 440053447785451 440056036137802 440054011728190 440054620179773 440056955761841 440055044260902 440058119573...
result:
ok 100000 lines
Test #84:
score: 38
Accepted
time: 1725ms
memory: 385148kb
input:
1600 2000 100000 100000 1 8 289771784 1 12 548038596 1 20 980104264 1 29 742095970 1 55 706584686 1 59 759137672 1 70 554606596 1 84 722165978 1 85 914751127 1 88 389825321 1 103 130816658 1 108 930777644 1 139 558789405 1 155 768946559 1 169 24361875 1 203 335720108 1 207 197200059 1 213 935840542 ...
output:
30255094883447 30255094883447 30255052772773 30254910877521 30254910877521 30254910877521 30254910877521 30255056512967 30255176137489 30255176137489 30255060253161 30255060253161 30255034242237 30255034242237 30255034242237 30255034242237 30254918357909 30254918357909 30254918357909 30254918357909 ...
result:
ok 100000 lines
Test #85:
score: 38
Accepted
time: 1407ms
memory: 444560kb
input:
1800 2000 100000 100000 1 420 744150843 1 753 314750535 2 55 279032206 2 875 364769982 3 1134 122217959 3 1495 672087036 4 619 497835927 4 640 441877239 4 923 353111886 4 1363 72990499 5 1318 49751485 5 1792 553560131 6 444 891849710 6 476 708883836 6 743 35616473 6 1657 195550720 7 358 614005842 7 ...
output:
990758495941564 990769766945569 990769516569467 990776679509111 990769433088993 990766390762555 990772012705193 990768669247391 990766032590425 990762964952582 990761813156302 990762989386757 990766902761507 990766525111062 990770196822949 990771909572444 990776720671665 990768222825104 990766997489...
result:
ok 100000 lines
Test #86:
score: 38
Accepted
time: 782ms
memory: 501220kb
input:
2000 2000 100000 100000 1 322 221010898 1 1715 473680966 2 129 596118935 2 1151 143138296 3 1901 520448447 3 1940 474870657 4 839 454933075 4 1768 89364917 5 1413 26355425 5 1855 568471439 6 1317 484622123 6 1701 496602087 7 1360 716854445 7 1632 825934752 8 412 987017811 8 856 901805042 9 1026 7851...
output:
47130014361994723 47130014361994723 47130014361994723 47129068537440624 47128122712886525 47128122712886525 47128122712886525 47129068537440624 47129068537440624 47129068537440624 47129068537440624 47129068537440624 47129068537440624 47128122712886525 47128122712886525 47128122712886525 471281227128...
result:
ok 100000 lines
Extra Test:
score: 0
Extra Test Passed