QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#559467 | #8222. 投票游戏 | Kevin5307 | 100 ✓ | 948ms | 70904kb | C++23 | 5.5kb | 2024-09-11 22:14:36 | 2024-09-11 22:14:37 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
mt19937_64 rng(20210448);
int n,q;
vector<int> G[200200];
int siz[200200],son[200200],in[200200],out[200200],dfn,tp[200200],low[200200],p[200200];
void dfs(int u)
{
siz[u]=1;
for(auto v:G[u])
{
dfs(v);
if(siz[v]>siz[son[u]])
son[u]=v;
siz[u]+=siz[v];
}
}
void dfs2(int u)
{
in[u]=++dfn;
if(!tp[u]) tp[u]=u;
low[tp[u]]=u;
if(son[u])
{
tp[son[u]]=tp[u];
dfs2(son[u]);
}
for(auto v:G[u])
if(v!=son[u])
dfs2(v);
out[u]=dfn;
}
ll a[200200],b[200200],f[200200],sta[200200];
int ls[200200],rs[200200];
ll sb[200200],lim[200200];
ull prior[200200];
void pushup(int x)
{
sb[x]=b[x]+sb[ls[x]]+sb[rs[x]];
lim[x]=min({rs[x]?lim[rs[x]]:1ll*inf*inf,f[x]+1+sb[rs[x]],ls[x]?(lim[ls[x]]+b[x]+sb[rs[x]]):1ll*inf*inf});
}
ll query(int x,ll f)
{
if(rs[x]&&lim[rs[x]]<=f)
return query(rs[x],f);
if(f>::f[x]+sb[rs[x]])
return f-sb[rs[x]];
if(!ls[x]) return f-sb[rs[x]]-b[x];
return query(ls[x],f-sb[rs[x]]-b[x]);
}
int merge(int x,int y)
{
if(!x||!y) return x+y;
if(prior[x]>prior[y])
{
rs[x]=merge(rs[x],y);
pushup(x);
return x;
}
else
{
ls[y]=merge(x,ls[y]);
pushup(y);
return y;
}
}
void split(int x,ll v,int nd,int &a,int &b)
{
if(!x)
{
a=b=0;
return ;
}
if(f[x]<v||(f[x]==v&&x<nd))
{
a=x;
split(rs[x],v,nd,rs[a],b);
pushup(a);
}
else
{
b=x;
split(ls[x],v,nd,a,ls[b]);
pushup(b);
}
}
struct info_t
{
ll Lim,A,B;
info_t(){}
info_t(ll _Lim,ll _A,ll _B):Lim(_Lim),A(_A),B(_B){}
const inline friend info_t operator +(const info_t &a,const info_t &b)
{
return info_t(b.Lim,b.A>=a.Lim?a.B:a.A,b.B>=a.Lim?a.B:a.A);
}
inline ll get(ll x){return x>=Lim?B:A;}
};
info_t segt[200200<<2];
#define ls (x<<1)
#define rs (ls|1)
void update(int x,int l,int r,int p,info_t info)
{
if(l==r)
{
segt[x]=info;
return ;
}
int mid=(l+r)/2;
if(p<=mid)
update(ls,l,mid,p,info);
else
update(rs,mid+1,r,p,info);
segt[x]=segt[ls]+segt[rs];
}
ll query(int x,int l,int r,int ql,int qr,ll v)
{
if(l==ql&&r==qr)
return segt[x].get(v);
int mid=(l+r)/2;
if(qr<=mid)
return query(ls,l,mid,ql,qr,v);
if(ql>mid)
return query(rs,mid+1,r,ql,qr,v);
return query(ls,l,mid,ql,mid,query(rs,mid+1,r,mid+1,qr,v));
}
#undef ls
#undef rs
int rt[200200];
void dfs3(int u)
{
sta[u]=a[u];
for(auto v:G[u])
{
dfs3(v);
if(v!=son[u])
{
sta[u]+=b[v];
sb[v]=b[v];
lim[v]=f[v]+1;
int A,B;
split(rt[u],f[v],v,A,B);
rt[u]=merge(A,merge(v,B));
}
}
if(!son[u])
{
f[u]=a[u];
update(1,1,n,in[u],info_t(0,a[u],a[u]));
return ;
}
ll f1=query(rt[u],sta[u]);
ll f2=query(rt[u],sta[u]+b[son[u]]);
update(1,1,n,in[u],info_t(f2,f2,f1));
f[u]=(f[son[u]]>=f2?f1:f2);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>q;
for(int i=2;i<=n;i++)
{
cin>>p[i];
G[p[i]].pb(i);
}
for(int i=1;i<=n;i++)
prior[i]=rng();
for(int i=1;i<=n;i++)
cin>>a[i];
for(int i=1;i<=n;i++)
cin>>b[i];
dfs(1);
dfs2(1);
dfs3(1);
while(q--)
{
int op;
cin>>op;
if(op==1)
{
int x,y,z;
cin>>x>>y>>z;
sta[x]-=a[x]-y;
a[x]=y;
if(x==tp[x]&&p[x])
{
int A,B,C;
split(rt[p[x]],f[x],x,A,B);
split(B,f[x],x+1,B,C);
rt[p[x]]=merge(A,C);
}
if(!son[x])
{
f[x]=a[x];
update(1,1,n,in[x],info_t(0,a[x],a[x]));
}
else
{
ll f1=query(rt[x],sta[x]);
ll f2=query(rt[x],sta[x]+b[son[x]]);
update(1,1,n,in[x],info_t(f2,f2,f1));
f[x]=query(1,1,n,in[x],in[low[tp[x]]],0);
}
if(x!=tp[x])
{
b[x]=z;
int x2=p[x];
if(x2==tp[x2]&&p[x2])
{
int A,B,C;
split(rt[p[x2]],f[x2],x2,A,B);
split(B,f[x2],x2+1,B,C);
rt[p[x2]]=merge(A,C);
}
ll f1=query(rt[x2],sta[x2]);
ll f2=query(rt[x2],sta[x2]+b[x]);
update(1,1,n,in[x2],info_t(f2,f2,f1));
f[x2]=(f[x]>=f2?f1:f2);
lim[x2]=f[x2]+1;
if(x2==tp[x2]&&p[x2])
{
int A,B;
split(rt[p[x2]],f[x2],x2,A,B);
rt[p[x2]]=merge(A,merge(x2,B));
}
}
int xx=x;
while(x)
{
int y=tp[x];
if(p[y])
{
int A,B,C;
split(rt[p[y]],f[y],y,A,B);
split(B,f[y],y+1,B,C);
rt[p[y]]=merge(A,C);
}
f[y]=query(1,1,n,in[y],in[low[y]],0);
lim[y]=f[y]+1;
if(!p[y]) break;
if(y==xx)
{
sta[p[y]]-=b[y]-z;
b[y]=z;
sb[y]=z;
lim[y]=f[y]+1;
}
int A,B;
split(rt[p[y]],f[y],y,A,B);
rt[p[y]]=merge(A,merge(y,B));
x=p[y];
ll f1=query(rt[x],sta[x]);
ll f2=query(rt[x],sta[x]+b[son[x]]);
update(1,1,n,in[x],info_t(f2,f2,f1));
}
}
else
{
int c,d;
cin>>c>>d;
ll fc=query(1,1,n,in[c],in[low[tp[c]]],0);
ll fd=query(1,1,n,in[d],in[low[tp[d]]],0);
if(mp(fc,c)>mp(fd,d))
cout<<"0\n";
else
cout<<"1\n";
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 0ms
memory: 16040kb
input:
20 500 1 1 3 1 3 5 6 6 7 3 5 3 9 5 4 7 7 18 2 42129194 82765784 1447057 29726963 82321558 32094641 22474113 49277574 27527633 20746795 47630926 92888389 26787144 80703040 43876864 97991729 12117966 75633318 33577855 93462601 69163546 49621952 45236756 46447931 34085269 55246550 54414402 99593046 103...
output:
0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 1 1 1 1 1 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 1 1 0 1 1 1 1 1 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 0 1 1 1 1 0 1 0 0 1 1 1 1 0 0 1 0 0 0 1 0 1 1 1 ...
result:
ok 238 numbers
Test #2:
score: 5
Accepted
time: 3ms
memory: 18060kb
input:
20 500 1 1 3 1 3 5 3 4 2 4 3 12 6 7 12 6 4 11 10 2 0 2 1 1 1 2 0 2 2 1 0 0 2 1 0 1 0 1 1 0 0 2 0 0 0 1 2 2 2 0 2 2 2 1 0 1 0 1 1 2 5 2 1 6 1 0 1 7 1 1 2 5 11 2 18 16 2 13 7 2 4 3 1 6 0 0 1 5 0 2 2 16 12 2 5 18 2 8 16 1 4 0 0 2 5 2 1 19 2 2 1 10 0 0 1 15 2 2 2 12 14 1 12 1 1 1 13 1 2 1 3 2 2 1 6 2 2 ...
output:
0 1 0 1 1 1 1 1 0 1 0 0 1 1 0 1 1 0 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 1 0 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 0 1 1 1 0 0 0 1 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 1 1 1 1 0 0 1 0 0 1 1 0 1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0 0 0 1 1 0 1 0 1 0 0 ...
result:
ok 226 numbers
Test #3:
score: 5
Accepted
time: 0ms
memory: 22172kb
input:
500 500 1 2 1 1 3 4 7 3 9 9 4 9 5 9 1 16 2 9 18 13 1 17 19 20 25 13 1 10 29 17 16 8 5 26 10 31 37 9 26 18 41 5 26 44 40 11 32 37 43 2 3 5 25 53 31 7 25 23 29 40 33 26 56 53 24 25 31 40 43 62 2 21 24 65 75 69 27 38 16 55 77 38 79 20 46 48 80 81 22 55 28 64 91 13 22 76 77 25 34 44 101 41 62 73 99 20 2...
output:
0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 0 1 0 0 0 1 0 1 0 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 1 1 1 1 1 1 0 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0 1 1 0 0 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 1 1 0 0 0 1 1 1 0 0 1 1 1 0 1 1 0 1 1 1 0 1 0 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 1 1 ...
result:
ok 247 numbers
Test #4:
score: 5
Accepted
time: 0ms
memory: 18136kb
input:
500 500 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...
output:
1 1 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 1 1 1 0 0 0 1 0 0 1 0 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 1 1 0 1 1 0 0 0 1 1 1 0 0 0 1 0 1 1 1 0 1 0 0 0 0 0 0 1 0 0 1 1 0 1 0 1 0 1 0 ...
result:
ok 255 numbers
Test #5:
score: 5
Accepted
time: 3ms
memory: 22076kb
input:
500 500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
1 1 0 0 0 1 0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 0 0 1 1 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 0 1 0 1 1 0 1 0 0 1 0 0 1 1 0 1 0 1 0 1 0 0 0 1 1 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 1 0 1 1 1 0 0 1 ...
result:
ok 243 numbers
Test #6:
score: 5
Accepted
time: 0ms
memory: 20192kb
input:
500 500 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...
output:
1 0 0 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 0 0 1 1 0 0 1 0 0 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 0 1 0 0 1 1 0 1 1 0 1 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 0 0 0 1 0 1 0 1 0 0 1 1 1 0 1 1 1 0 0 0 0 0 0 1 1 0 ...
result:
ok 248 numbers
Subtask #2:
score: 10
Accepted
Dependency #1:
100%
Accepted
Test #7:
score: 10
Accepted
time: 3ms
memory: 17996kb
input:
100 3000 1 1 2 1 3 4 1 4 7 8 1 9 5 7 2 9 7 7 1 3 20 22 16 18 23 15 24 4 14 1 21 4 21 32 14 14 33 28 13 4 20 27 41 43 18 26 4 8 24 16 30 16 13 45 20 46 6 17 4 48 24 23 54 59 61 42 62 41 26 35 10 40 9 41 35 68 67 63 48 53 10 59 81 54 15 22 86 69 49 52 55 3 27 52 48 15 54 16 87 32745005 92702519 399483...
output:
0 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 0 1 0 1 1 1 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 1 0 0 0 1 1 0 0 0 0 1 1 1 1 0 1 1 0 1 1 0 0 1 1 0 1 0 0 0 1 0 1 1 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 0 0 1 0 1 0 0 1 1 0 0 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 ...
result:
ok 1494 numbers
Test #8:
score: 10
Accepted
time: 3ms
memory: 16088kb
input:
100 3000 1 2 3 1 1 5 7 7 1 3 3 6 7 9 12 2 11 5 19 20 10 16 7 7 3 22 16 24 5 27 22 13 24 24 24 25 5 11 16 22 40 26 6 39 14 2 46 21 43 50 20 27 28 7 54 41 55 16 36 26 38 46 4 29 63 12 45 64 28 47 53 33 28 28 44 17 27 36 41 22 39 55 32 79 57 64 76 48 45 45 61 69 73 67 68 92 36 66 73 0 1 2 2 0 0 1 0 2 1...
output:
0 1 0 1 1 1 1 0 1 0 1 1 1 0 0 1 0 0 0 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 1 1 1 1 0 0 1 1 1 1 0 1 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 0 0 0 0 1 1 1 0 0 1 0 1 0 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0 1 0 0 1 0 0 1 1 1 1 1 1 1 0 1 1 1 ...
result:
ok 1495 numbers
Test #9:
score: 10
Accepted
time: 6ms
memory: 18416kb
input:
3000 3000 1 1 2 1 1 4 7 1 1 9 6 7 1 14 11 1 16 6 17 20 4 18 4 21 22 23 17 19 20 15 6 22 4 2 28 16 19 19 24 2 31 38 20 33 1 44 13 21 10 42 40 27 4 34 25 22 15 53 43 12 11 31 54 24 31 27 16 43 41 69 23 38 70 66 58 60 7 60 30 61 28 26 14 30 55 22 49 37 31 6 59 22 39 8 56 17 35 67 1 63 43 6 82 41 56 30 ...
output:
1 0 1 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 0 0 1 1 1 1 0 0 1 0 1 1 0 1 1 0 0 ...
result:
ok 1450 numbers
Test #10:
score: 10
Accepted
time: 2ms
memory: 18632kb
input:
3000 3000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...
output:
0 0 1 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 1 0 0 0 1 1 0 1 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 1 0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0 1 0 1 0 0 0 1 0 0 1 1 0 0 1 1 0 0 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 ...
result:
ok 1532 numbers
Test #11:
score: 10
Accepted
time: 3ms
memory: 22120kb
input:
3000 3000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
1 1 1 0 0 1 1 1 1 0 1 0 1 1 0 1 0 0 0 1 1 1 1 0 0 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 1 1 0 1 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 0 1 1 0 1 1 1 1 0 1 0 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 1 0 1 0 1 1 0 1 0 1 0 1 0 0 0 0 0 0 1 0 0 1 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1 0 1 0 0 0 1 0 1 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 ...
result:
ok 1481 numbers
Test #12:
score: 10
Accepted
time: 4ms
memory: 16700kb
input:
3000 3000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...
output:
0 0 1 1 0 0 0 0 1 1 1 1 1 0 0 1 0 1 1 0 1 1 0 1 0 1 0 1 1 1 1 1 0 1 0 1 1 0 0 1 0 1 1 0 0 0 1 0 1 0 1 1 1 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 1 1 0 0 0 1 0 0 1 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 0 0 1 0 0 1 1 1 0 0 1 0 1 0 1 0 1 1 1 1 0 1 1 0 1 0 1 0 1 1 1 0 0 0 1 1 1 0 1 0 0 1 1 ...
result:
ok 1541 numbers
Subtask #3:
score: 10
Accepted
Test #13:
score: 10
Accepted
time: 77ms
memory: 18008kb
input:
200 200000 1 2 3 3 5 3 1 6 2 9 11 5 5 2 4 9 17 8 1 4 10 20 18 20 23 13 16 28 15 4 6 27 26 11 30 25 10 2 13 23 25 35 4 8 40 43 36 26 7 27 45 35 14 31 54 45 9 8 9 54 16 32 62 9 29 2 43 39 34 39 27 2 52 56 6 9 48 26 66 28 35 57 79 13 71 61 38 43 80 26 61 26 79 1 24 64 79 15 41 42 56 55 6 24 92 43 89 76...
output:
0 0 0 0 1 1 1 1 1 0 0 1 1 0 1 0 0 0 0 0 1 0 0 0 0 1 1 0 1 1 0 1 0 0 1 1 1 1 1 0 0 0 0 1 1 1 0 1 1 1 1 1 0 0 0 0 0 1 1 0 1 1 1 1 1 1 0 0 0 0 1 1 0 1 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 0 1 0 0 1 0 1 0 1 1 1 0 0 1 0 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 1 0 1 1 0 0 0 1 1 1 1 0 0 1 0 0 1 0 1 0 0 ...
result:
ok 100045 numbers
Test #14:
score: 10
Accepted
time: 82ms
memory: 20052kb
input:
200 200000 1 2 3 2 1 5 2 8 9 2 6 7 12 11 9 6 16 15 11 2 17 13 23 7 23 12 22 2 12 28 11 22 9 7 11 10 16 36 25 5 8 20 41 38 19 38 2 16 38 6 44 33 42 41 42 37 36 33 49 35 13 3 9 26 50 48 31 65 3 2 13 64 8 12 55 69 67 35 59 58 16 43 1 21 64 41 5 85 22 81 66 54 6 44 25 26 53 78 58 42 7 25 68 30 86 9 36 3...
output:
1 0 1 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 1 0 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 0 0 1 0 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 0 1 0 1 0 0 0 1 0 0 1 0 1 1 0 1 0 1 1 1 1 0 0 1 1 ...
result:
ok 99983 numbers
Test #15:
score: 10
Accepted
time: 134ms
memory: 16180kb
input:
2000 200000 1 1 3 4 3 2 5 1 8 9 2 7 6 7 6 12 5 7 15 8 16 10 18 23 6 19 24 14 23 8 6 22 18 14 8 5 36 4 30 14 19 11 28 1 15 23 11 16 24 46 10 34 1 9 17 21 2 9 13 27 13 5 43 46 14 19 49 58 32 15 38 11 18 1 30 69 51 5 59 49 21 31 1 75 44 78 6 52 5 11 12 91 16 32 4 27 40 80 13 53 95 54 76 76 63 27 2 102 ...
output:
0 1 1 1 0 1 1 0 0 1 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 0 0 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 1 0 0 0 1 1 0 1 1 0 1 1 0 0 1 1 ...
result:
ok 99757 numbers
Test #16:
score: 10
Accepted
time: 195ms
memory: 17656kb
input:
20000 200000 1 1 2 1 5 3 6 5 2 6 10 6 13 13 6 14 15 17 7 2 15 17 13 23 2 14 11 20 20 16 31 19 27 29 24 28 30 12 5 31 4 21 5 22 7 9 18 48 11 17 24 34 51 22 33 31 26 17 3 9 50 28 51 47 14 58 35 19 15 49 21 45 32 59 12 46 21 61 50 64 24 51 31 34 17 30 13 77 25 42 89 22 81 45 70 35 94 77 47 24 94 92 59 ...
output:
1 0 0 1 0 0 1 0 0 1 0 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 1 0 0 1 0 1 1 1 1 1 0 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 0 1 0 1 0 0 1 1 1 0 1 1 1 1 1 1 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 0 1 1 1 1 1 1 1 0 ...
result:
ok 99952 numbers
Test #17:
score: 10
Accepted
time: 432ms
memory: 42948kb
input:
200000 200000 1 2 3 3 2 1 5 2 1 8 1 8 10 8 3 10 10 9 9 6 1 12 15 21 5 19 2 10 3 3 6 19 30 6 23 2 13 34 23 5 5 29 26 23 16 28 38 40 47 30 35 45 36 1 10 2 36 18 49 49 28 22 15 7 27 4 42 59 60 7 51 56 50 46 18 31 37 58 5 76 16 41 1 67 59 35 3 58 50 1 48 90 69 57 29 89 89 47 6 29 12 80 15 56 50 100 11 1...
output:
0 0 0 1 1 0 0 1 0 0 0 1 1 1 0 0 1 1 1 0 1 1 1 0 0 0 1 0 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 0 1 0 0 1 0 0 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 0 1 0 0 1 0 0 0 0 0 0 1 0 0 ...
result:
ok 99519 numbers
Subtask #4:
score: 25
Accepted
Test #18:
score: 25
Accepted
time: 115ms
memory: 18012kb
input:
200 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 1 0 0 1 0 1 0 1 1 1 1 0 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 0 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1 0 1 1 0 0 1 1 0 1 0 1 1 1 0 0 0 1 0 1 1 0 0 0 1 0 0 0 0 1 1 0 1 0 1 1 0 1 1 1 0 0 1 0 1 1 1 1 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 ...
result:
ok 99788 numbers
Test #19:
score: 25
Accepted
time: 128ms
memory: 15976kb
input:
200 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 1 0 0 0 1 1 0 0 1 1 1 1 1 1 0 1 0 0 0 1 0 1 0 0 1 1 1 1 0 1 0 ...
result:
ok 100002 numbers
Test #21:
score: 25
Accepted
time: 259ms
memory: 21744kb
input:
20000 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 0 0 0 1 0 1 1 0 0 0 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 0 0 1 0 0 0 0 ...
result:
ok 99886 numbers
Test #22:
score: 25
Accepted
time: 661ms
memory: 37212kb
input:
200000 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1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1 1 1 1 0 1 1 0 1 0 0 1 0 0 1 0 1 1 1 0 1 0 0 0 0 1 0 1 1 0 0 1 1 0 1 1 0 1 0 1 0 1 1 0 1 1 0 0 1 0 1 0 1 1 1 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 0 1 1 0 ...
result:
ok 100269 numbers
Subtask #5:
score: 20
Accepted
Test #26:
score: 20
Accepted
time: 46ms
memory: 15988kb
input:
200 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 1...
output:
1 0 1 0 1 1 1 1 0 1 1 1 0 0 0 0 1 0 1 1 0 1 0 0 1 1 1 0 1 0 0 0 1 0 1 1 0 0 0 1 1 1 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 1 1 1 1 1 1 1 0 0 0 1 0 0 1 0 0 1 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 0 1 1 1 0 1 0 1 1 1 0 0 1 1 0 1 0 0 1 0 0 0 0 1 0 1 1 1 0 1 1 1 0 ...
result:
ok 100455 numbers
Test #27:
score: 20
Accepted
time: 54ms
memory: 18104kb
input:
200 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 1...
output:
0 1 0 0 1 0 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 0 1 0 0 0 0 1 1 1 0 0 1 0 1 1 1 1 0 0 0 1 1 0 1 1 0 0 0 1 0 1 0 0 1 0 1 1 0 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0 0 1 0 1 0 1 1 1 1 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 0 1 0 0 0 1 0 0 1 1 1 0 1 0 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 0 0 0 0 1 0 0 1 1 1 1 0 0 ...
result:
ok 99902 numbers
Test #28:
score: 20
Accepted
time: 69ms
memory: 14360kb
input:
2000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...
output:
0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 1 0 0 1 0 1 1 0 0 1 0 0 1 0 0 1 1 1 1 0 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 0 0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 1 1 1 0 0 0 0 1 1 1 0 1 0 0 1 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 1 1 1 ...
result:
ok 99882 numbers
Test #29:
score: 20
Accepted
time: 88ms
memory: 22988kb
input:
20000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...
output:
0 0 0 0 1 0 0 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 0 0 1 0 1 0 0 1 1 1 1 0 0 1 1 1 0 1 1 0 1 1 0 0 0 0 1 0 1 0 1 1 0 0 0 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 1 0 1 0 1 0 1 0 0 1 0 0 1 1 0 0 0 1 1 0 0 0 1 0 1 0 1 1 0 1 0 1 0 0 1 1 1 1 1 0 1 1 0 1 0 0 1 1 1 0 1 0 1 0 1 0 0 1 0 1 0 1 ...
result:
ok 100151 numbers
Test #30:
score: 20
Accepted
time: 194ms
memory: 70892kb
input:
200000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
0 0 1 0 1 1 1 0 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 0 0 1 1 0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 1 0 1 0 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 0 1 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 ...
result:
ok 100291 numbers
Test #31:
score: 20
Accepted
time: 186ms
memory: 70224kb
input:
200000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
0 1 1 0 0 0 0 1 1 0 0 1 0 1 1 1 1 1 1 0 1 0 0 0 1 0 0 1 1 1 0 0 1 0 0 0 1 0 0 1 1 0 1 1 1 0 1 0 1 1 1 1 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 1 1 0 1 0 1 1 1 1 0 0 1 0 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 1 0 1 0 0 1 0 0 1 1 0 1 0 1 1 0 1 0 1 0 1 0 0 0 0 1 0 0 1 1 1 1 ...
result:
ok 100358 numbers
Test #32:
score: 20
Accepted
time: 178ms
memory: 70632kb
input:
200000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
1 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 0 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 0 0 0 0 1 1 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 1 0 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 1 1 0 1 0 1 0 1 1 0 0 0 1 1 0 1 1 1 1 0 1 1 0 1 0 0 1 0 0 ...
result:
ok 66538 numbers
Subtask #6:
score: 30
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Test #33:
score: 30
Accepted
time: 947ms
memory: 36000kb
input:
200000 200000 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 5...
output:
0 0 0 1 0 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 0 0 0 1 0 0 1 1 1 1 1 1 0 1 0 1 0 0 1 0 1 0 1 1 0 0 0 1 1 0 0 0 1 1 0 1 1 1 0 ...
result:
ok 20048 numbers
Test #34:
score: 30
Accepted
time: 216ms
memory: 57144kb
input:
200000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
0 0 1 0 0 0 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 0 0 1 1 1 0 1 1 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 1 0 1 1 1 0 1 0 0 0 1 1 0 0 0 1 1 0 1 1 0 1 0 1 1 0 1 0 1 1 1 1 0 0 1 0 1 0 1 0 0 ...
result:
ok 66294 numbers
Test #35:
score: 30
Accepted
time: 50ms
memory: 16052kb
input:
200 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 1...
output:
1 1 1 1 1 1 0 1 1 0 0 0 1 0 1 0 1 1 1 0 0 1 0 1 0 0 1 1 0 1 0 1 1 0 0 0 0 1 1 1 0 0 1 0 0 1 1 0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 1 0 1 0 1 1 1 1 0 1 0 0 0 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 1 0 1 0 ...
result:
ok 100092 numbers
Test #36:
score: 30
Accepted
time: 72ms
memory: 16436kb
input:
2000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...
output:
0 0 0 1 1 1 1 1 0 1 0 1 1 0 1 1 1 0 1 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 1 1 0 1 0 1 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 1 1 1 0 1 0 1 0 0 1 1 0 1 0 1 1 0 0 0 1 1 0 0 0 1 1 1 0 1 0 1 0 1 0 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 0 ...
result:
ok 100456 numbers
Test #37:
score: 30
Accepted
time: 97ms
memory: 22852kb
input:
20000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...
output:
1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0 0 1 1 0 1 1 0 1 0 1 1 0 1 1 1 1 1 1 0 0 0 1 1 1 1 0 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 0 0 1 0 0 1 1 0 1 0 0 0 1 1 0 1 0 1 0 0 0 1 0 1 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 1 0 1 1 1 1 1 1 ...
result:
ok 100428 numbers
Test #38:
score: 30
Accepted
time: 195ms
memory: 69616kb
input:
200000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
1 0 0 0 1 1 1 1 0 1 0 0 1 0 1 0 1 0 0 1 1 1 0 1 0 0 0 0 1 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 1 1 0 1 1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 1 0 0 1 0 1 1 1 0 1 0 1 1 1 0 0 1 1 1 0 0 1 0 1 1 0 1 ...
result:
ok 99950 numbers
Test #39:
score: 30
Accepted
time: 210ms
memory: 70236kb
input:
200000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
1 0 0 0 1 0 0 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 1 0 0 0 1 1 1 0 0 1 1 1 0 1 0 0 0 1 1 1 0 0 0 0 1 0 0 0 1 0 1 0 1 0 1 1 1 0 0 0 1 0 0 1 1 1 1 0 1 0 1 0 0 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 1 0 0 0 0 0 1 1 1 0 1 1 0 0 1 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 1 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 0 0 1 1 0 1 ...
result:
ok 99920 numbers
Test #40:
score: 30
Accepted
time: 187ms
memory: 70904kb
input:
200000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
0 0 0 0 1 1 0 1 0 1 1 1 1 1 1 0 1 0 1 0 1 0 0 0 1 1 1 1 0 1 0 0 1 0 1 0 0 0 1 0 0 1 0 0 0 0 0 1 0 1 1 0 1 1 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 1 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 1 0 0 0 1 0 1 0 0 1 0 1 1 1 0 0 0 1 0 0 0 0 1 1 0 1 1 0 0 1 1 0 0 1 1 1 1 0 1 1 0 1 1 0 0 1 0 1 1 1 1 1 0 ...
result:
ok 100012 numbers
Test #41:
score: 30
Accepted
time: 47ms
memory: 16104kb
input:
200 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 1...
output:
0 1 0 0 0 1 0 1 1 1 0 0 1 1 1 1 0 0 1 1 1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 0 1 0 1 1 0 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 1 1 0 0 0 1 0 1 0 1 0 1 1 1 0 1 1 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 1 0 0 1 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 ...
result:
ok 99885 numbers
Test #42:
score: 30
Accepted
time: 948ms
memory: 34356kb
input:
200000 200000 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 5...
output:
1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 0 1 0 1 1 1 0 1 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 1 1 0 0 1 0 0 1 1 1 0 0 0 0 1 0 1 0 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 1 1 0 0 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 1 0 1 0 0 ...
result:
ok 20265 numbers
Test #43:
score: 30
Accepted
time: 916ms
memory: 34516kb
input:
200000 200000 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 5...
output:
1 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 1 1 0 1 0 0 1 1 1 1 0 1 1 1 0 0 1 1 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 1 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 0 1 0 0 1 1 0 1 1 1 0 0 0 1 1 0 0 0 0 0 1 0 1 1 1 0 1 1 1 1 0 1 1 0 1 1 0 1 0 1 1 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 0 1 1 1 ...
result:
ok 20034 numbers
Test #44:
score: 30
Accepted
time: 861ms
memory: 37848kb
input:
200000 200000 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 5...
output:
1 0 0 0 1 0 1 0 0 1 1 1 0 1 0 1 0 0 0 0 1 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 0 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 1 1 0 0 0 1 0 0 1 1 0 1 0 0 1 1 1 1 1 1 1 1 1 0 1 0 1 0 0 1 1 1 1 1 0 1 1 0 0 1 0 0 0 0 0 1 1 0 1 1 0 1 0 0 0 1 0 1 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 0 1 1 0 0 1 ...
result:
ok 20016 numbers
Test #45:
score: 30
Accepted
time: 681ms
memory: 38760kb
input:
200000 200000 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 5...
output:
1 0 0 0 0 0 1 0 1 1 1 0 1 1 1 1 0 0 1 1 0 0 0 1 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0 1 1 1 0 0 0 1 0 0 1 1 0 1 0 0 0 1 1 1 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 0 1 1 0 0 1 0 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 1 1 0 1 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 1 0 0 0 1 0 1 1 0 1 0 0 0 1 0 1 0 0 1 1 1 0 0 1 1 1 0 0 0 1 ...
result:
ok 20088 numbers
Extra Test:
score: 0
Extra Test Passed