QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#561044 | #8219. 线段树 | zhulexuan | 100 ✓ | 208ms | 168824kb | C++14 | 5.0kb | 2024-09-12 19:44:38 | 2024-09-12 19:44:40 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf INT_MAX
#define fr(i,l,r) for (i=(l); i<=(r); i++)
#define rfr(i,l,r) for (i=(l); i>=(r); i--)
template<typename T>inline void read(T &n){
T w=1; n=0; char ch=getchar();
while (!isdigit(ch) && ch!=EOF){ if (ch=='-') w=-1; ch=getchar(); }
while (isdigit(ch) && ch!=EOF){ n=(n<<3)+(n<<1)+(ch&15); ch=getchar(); }
n*=w;
}
template<typename T>inline void write(T x){
if (x==0){ putchar('0'); return ; }
T tmp;
if (x>0) tmp=x;
else tmp=-x;
if (x<0) putchar('-');
char F[105];
long long cnt=0;
while (tmp){
F[++cnt]=tmp%10+48;
tmp/=10;
}
while (cnt) putchar(F[cnt--]);
}
#define Min(x,y) x = min(x,y)
#define Max(x,y) x = max(x,y)
//基础配置=================================================================================
struct Suiji{
#define R ((ll)rand())
Suiji(){
srand((unsigned)time(NULL));
return ;
}
ll rrr(){
return R*R*R*R+R*R*R+R*R+R;
}
ll M(ll l,ll r){
ll ans,mod;
ans=rrr();
mod=r-l+1;
ans=(ans%mod+mod)%mod;
return ans+l;
}
#undef R
}suiji;
#define M(l,r) (suiji.M(l,r))
const ll N = 200005, mod = 998244353, Lim = (1ll<<60)-1;
ll n,m,nw,cnt;
ll px[N];
ll lf[N+N],rh[N+N];
ll lc[N+N],rc[N+N];
ll val[N];
void build(ll s,ll l,ll r){
// if (s>100) return ;
// printf("%lld : %lld ~ %lld\n",s,l,r);
lf[s] = l; rh[s] = r;
if (l==r) return ;
ll mid = px[++nw];
lc[s] = ++cnt; rc[s] = ++cnt;
// printf("%lld ~ %lld : mid = %lld\n",l,r,px[nw]);
build(lc[s],l,mid);
build(rc[s],mid+1,r);
}
struct Tree{
ll cnt,rt[N+N];
struct node{
ll lc,rc;
ll v,tag;
void init(){
lc = rc = 0;
v = 0; tag = 1;
}
}t[20*N];
void build(){
cnt = 0;
memset(rt,0,sizeof(rt));
t[0].init();
}
ll nww(){
t[++cnt].init();
return cnt;
}
void insert(ll &s,ll x,ll v,ll L,ll R){
if (!s) s = nww();
if (L==R){ t[s].v = v; return ; }
ll mid = (L+R)>>1;
if (x<=mid) insert(t[s].lc,x,v,L,mid);
else insert(t[s].rc,x,v,mid+1,R);
t[s].v = t[t[s].lc].v + t[t[s].rc].v;
}
void chg(ll s,ll k){
if (!s) return ;
t[s].v = t[s].v*k %mod;
t[s].tag = t[s].tag*k %mod;
}
void down(ll s){
if (!s) return ;
if (t[s].tag==1) return ;
chg(t[s].lc,t[s].tag);
chg(t[s].rc,t[s].tag);
t[s].tag = 1;
}
pair<ll,ll> merge(ll x,ll y,ll kx,ll ky,ll L,ll R){
// chg(x,kx); chg(y,ky);
if (!x && !y){ return make_pair(0,0); }
if (!x){ chg(y,ky); return make_pair(y,0); }
if (!y){ chg(x,kx); return make_pair(x,0); }
if (L==R){
ll v = t[x].v*t[y].v %mod;
( t[x].v = kx*t[x].v + ky*t[y].v + v ) %=mod;
// printf("%lld ~ %lld : v = %lld\n",L,R,t[x].v);
return make_pair(x,v);
}
down(x); down(y);
ll mid = (L+R)>>1;
pair<ll,ll> p; ll v = kx*t[x].v + ky*t[y].v, vl,vr;
p = merge(t[x].lc,t[y].lc,kx,ky,L,mid);
t[x].lc = p.first; vl = p.second;
p = merge(t[x].rc,t[y].rc,kx,ky,mid+1,R);
t[x].rc = p.first; vr = p.second;
t[x].v = (v+vl+vr)%mod;
return make_pair(x,(vl+vr)%mod);
}
ll qry(ll s,ll x,ll L,ll R){
if (!s) return 0;
if (L==R) return t[s].v;
down(s);
ll mid = (L+R)>>1;
if (x<=mid) return qry(t[s].lc,x,L,mid);
else return qry(t[s].rc,x,mid+1,R);
}
}tr;
ll g[N+N];
ll sum; map<ll,ll> id;
void dfs(ll x){
if (lf[x]==rh[x]){
g[x] = 1;
tr.insert(tr.rt[x],val[lf[x]-1],1,1,sum);
// printf("g[%lld] = 1\n",x);
// printf("f[%lld][%lld] = 1\n",x,val[lf[x]-1]);
return ;
}
ll ls = lc[x], rs = rc[x];
dfs(lc[x]); dfs(rc[x]);
pair<ll,ll> p = tr.merge(tr.rt[ls],tr.rt[rs],g[rs],g[ls],1,sum);
tr.rt[x] = p.first;
// printf("tr = %lld\n",tr.t[tr.rt[x]].v);
( g[x] = tr.t[tr.rt[x]].v + 2*g[ls]*g[rs] ) %=mod;
// printf("g[%lld] = %lld\n",x,g[x]);
return ;
}
int main(){
// freopen("a.in","r",stdin);
// freopen(".out","w",stdout);
ll i,j;
read(n); read(m);
fr(i,1,n-1) read(px[i]);
nw = 0; cnt = 1; build(1,1,n);
fr(i,1,m){
ll l,r;
read(l); read(r);
// l++; r++;
ll v = M(1,Lim);
val[l] ^= v;
val[r] ^= v;
}
fr(i,1,n) val[i] ^= val[i-1];
fr(i,0,n){
if (!id[val[i]]) id[val[i]] = ++sum;
val[i] = id[val[i]];
}
// fr(i,0,n) printf("val[%lld] = %lld\n",i,val[i]);
tr.build();
dfs(1);
ll ans = g[1];
if (id.count(0)) ans += tr.qry(tr.rt[1],id[0],1,sum);
ans = (ans%mod+mod)%mod;
write(ans);
return 0;
}
//g++ a.cpp -o a -Wall -Wl,--stack=512000000 -std=c++11 -O2
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 0ms
memory: 18024kb
input:
2 1 1 0 2
output:
5
result:
ok 1 number(s): "5"
Test #2:
score: 6
Accepted
time: 0ms
memory: 20064kb
input:
2 1 1 1 2
output:
5
result:
ok 1 number(s): "5"
Test #3:
score: 6
Accepted
time: 0ms
memory: 22116kb
input:
5 2 2 1 4 3 1 3 2 5
output:
193
result:
ok 1 number(s): "193"
Test #4:
score: 6
Accepted
time: 0ms
memory: 20160kb
input:
10 10 5 2 1 3 4 7 6 8 9 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10
output:
70848
result:
ok 1 number(s): "70848"
Test #5:
score: 6
Accepted
time: 0ms
memory: 22200kb
input:
2 2 1 0 1 0 2
output:
4
result:
ok 1 number(s): "4"
Test #6:
score: 6
Accepted
time: 3ms
memory: 18148kb
input:
3 3 1 2 0 1 0 2 0 3
output:
14
result:
ok 1 number(s): "14"
Test #7:
score: 6
Accepted
time: 0ms
memory: 18108kb
input:
4 4 1 2 3 0 1 0 2 0 3 0 4
output:
48
result:
ok 1 number(s): "48"
Test #8:
score: 6
Accepted
time: 3ms
memory: 20092kb
input:
5 5 3 1 2 4 0 1 0 2 0 3 0 4 0 5
output:
164
result:
ok 1 number(s): "164"
Test #9:
score: 6
Accepted
time: 0ms
memory: 18016kb
input:
6 6 4 2 1 3 5 0 1 0 2 0 3 0 4 0 5 0 6
output:
544
result:
ok 1 number(s): "544"
Test #10:
score: 6
Accepted
time: 0ms
memory: 20120kb
input:
7 7 3 2 1 5 4 6 0 1 0 2 0 3 0 4 0 5 0 6 0 7
output:
1856
result:
ok 1 number(s): "1856"
Test #11:
score: 6
Accepted
time: 4ms
memory: 21108kb
input:
8 8 3 1 2 4 7 5 6 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8
output:
6528
result:
ok 1 number(s): "6528"
Test #12:
score: 6
Accepted
time: 0ms
memory: 20064kb
input:
9 9 3 1 2 4 7 6 5 8 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9
output:
21520
result:
ok 1 number(s): "21520"
Test #13:
score: 6
Accepted
time: 3ms
memory: 20072kb
input:
10 10 8 2 1 3 4 6 5 7 9 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10
output:
71296
result:
ok 1 number(s): "71296"
Test #14:
score: 6
Accepted
time: 0ms
memory: 20024kb
input:
2 3 1 0 1 0 2 1 2
output:
4
result:
ok 1 number(s): "4"
Test #15:
score: 6
Accepted
time: 2ms
memory: 20060kb
input:
3 6 1 2 0 1 0 2 0 3 1 2 1 3 2 3
output:
14
result:
ok 1 number(s): "14"
Test #16:
score: 6
Accepted
time: 0ms
memory: 22072kb
input:
4 10 1 2 3 0 1 0 2 0 3 0 4 1 2 1 3 1 4 2 3 2 4 3 4
output:
48
result:
ok 1 number(s): "48"
Test #17:
score: 6
Accepted
time: 3ms
memory: 20008kb
input:
5 15 1 4 3 2 0 1 0 2 0 3 0 4 0 5 1 2 1 3 1 4 1 5 2 3 2 4 2 5 3 4 3 5 4 5
output:
164
result:
ok 1 number(s): "164"
Test #18:
score: 6
Accepted
time: 0ms
memory: 22192kb
input:
6 21 5 3 1 2 4 0 1 0 2 0 3 0 4 0 5 0 6 1 2 1 3 1 4 1 5 1 6 2 3 2 4 2 5 2 6 3 4 3 5 3 6 4 5 4 6 5 6
output:
544
result:
ok 1 number(s): "544"
Test #19:
score: 6
Accepted
time: 0ms
memory: 22116kb
input:
7 28 4 1 2 3 6 5 0 1 0 2 0 3 0 4 0 5 0 6 0 7 1 2 1 3 1 4 1 5 1 6 1 7 2 3 2 4 2 5 2 6 2 7 3 4 3 5 3 6 3 7 4 5 4 6 4 7 5 6 5 7 6 7
output:
1912
result:
ok 1 number(s): "1912"
Test #20:
score: 6
Accepted
time: 0ms
memory: 20152kb
input:
8 36 5 2 1 3 4 7 6 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 1 2 1 3 1 4 1 5 1 6 1 7 1 8 2 3 2 4 2 5 2 6 2 7 2 8 3 4 3 5 3 6 3 7 3 8 4 5 4 6 4 7 4 8 5 6 5 7 5 8 6 7 6 8 7 8
output:
6304
result:
ok 1 number(s): "6304"
Test #21:
score: 6
Accepted
time: 0ms
memory: 20140kb
input:
9 45 6 2 1 4 3 5 7 8 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 3 2 4 2 5 2 6 2 7 2 8 2 9 3 4 3 5 3 6 3 7 3 8 3 9 4 5 4 6 4 7 4 8 4 9 5 6 5 7 5 8 5 9 6 7 6 8 6 9 7 8 7 9 8 9
output:
20736
result:
ok 1 number(s): "20736"
Test #22:
score: 6
Accepted
time: 0ms
memory: 20064kb
input:
10 55 6 3 2 1 4 5 8 7 9 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 3 4 3 5 3 6 3 7 3 8 3 9 3 10 4 5 4 6 4 7 4 8 4 9 4 10 5 6 5 7 5 8 5 9 5 10 6 7 6 8 6 9 6 10 7 8 7 9 7 10 8 9 8 10 9 10
output:
70784
result:
ok 1 number(s): "70784"
Test #23:
score: 6
Accepted
time: 3ms
memory: 20024kb
input:
2 1 1 0 2
output:
5
result:
ok 1 number(s): "5"
Test #24:
score: 6
Accepted
time: 0ms
memory: 22188kb
input:
3 1 2 1 2 3
output:
21
result:
ok 1 number(s): "21"
Test #25:
score: 6
Accepted
time: 3ms
memory: 20144kb
input:
4 1 2 1 3 0 1
output:
85
result:
ok 1 number(s): "85"
Test #26:
score: 6
Accepted
time: 0ms
memory: 20076kb
input:
5 1 4 1 3 2 0 5
output:
341
result:
ok 1 number(s): "341"
Test #27:
score: 6
Accepted
time: 0ms
memory: 20196kb
input:
6 1 5 1 2 3 4 0 2
output:
1260
result:
ok 1 number(s): "1260"
Test #28:
score: 6
Accepted
time: 0ms
memory: 18104kb
input:
7 1 2 1 6 4 3 5 3 4
output:
5545
result:
ok 1 number(s): "5545"
Test #29:
score: 6
Accepted
time: 0ms
memory: 18088kb
input:
8 1 5 4 2 1 3 6 7 4 7
output:
14745
result:
ok 1 number(s): "14745"
Test #30:
score: 6
Accepted
time: 0ms
memory: 20072kb
input:
9 1 3 2 1 8 7 6 4 5 3 6
output:
101031
result:
ok 1 number(s): "101031"
Test #31:
score: 6
Accepted
time: 0ms
memory: 20968kb
input:
10 1 7 4 2 1 3 5 6 9 8 9 10
output:
373889
result:
ok 1 number(s): "373889"
Test #32:
score: 6
Accepted
time: 3ms
memory: 20060kb
input:
10 2 1 9 8 5 4 3 2 7 6 1 8 2 5
output:
261049
result:
ok 1 number(s): "261049"
Test #33:
score: 6
Accepted
time: 2ms
memory: 17964kb
input:
10 3 5 1 4 3 2 7 6 9 8 1 8 3 9 6 8
output:
122329
result:
ok 1 number(s): "122329"
Test #34:
score: 6
Accepted
time: 0ms
memory: 20140kb
input:
10 4 4 1 2 3 8 6 5 7 9 0 8 0 10 1 2 4 7
output:
175630
result:
ok 1 number(s): "175630"
Test #35:
score: 6
Accepted
time: 0ms
memory: 18108kb
input:
10 5 3 1 2 8 6 5 4 7 9 3 8 5 6 6 7 7 8 8 9
output:
176820
result:
ok 1 number(s): "176820"
Test #36:
score: 6
Accepted
time: 0ms
memory: 20004kb
input:
10 6 7 6 4 1 3 2 5 9 8 0 2 2 3 2 4 3 5 5 10 6 10
output:
123102
result:
ok 1 number(s): "123102"
Test #37:
score: 6
Accepted
time: 2ms
memory: 20156kb
input:
10 7 6 1 3 2 5 4 8 7 9 2 5 2 7 2 10 3 10 4 7 5 10 8 10
output:
107712
result:
ok 1 number(s): "107712"
Test #38:
score: 6
Accepted
time: 2ms
memory: 20136kb
input:
10 8 1 3 2 7 4 6 5 9 8 0 2 1 7 1 10 2 9 3 7 4 6 4 8 5 7
output:
70272
result:
ok 1 number(s): "70272"
Test #39:
score: 6
Accepted
time: 0ms
memory: 20060kb
input:
10 9 4 1 2 3 5 8 7 6 9 0 7 0 10 1 7 1 9 1 10 3 6 4 5 4 7 6 10
output:
82208
result:
ok 1 number(s): "82208"
Test #40:
score: 6
Accepted
time: 2ms
memory: 20196kb
input:
10 10 6 4 2 1 3 5 8 7 9 0 4 1 3 1 9 2 5 2 9 2 10 3 8 4 5 4 8 4 9
output:
89920
result:
ok 1 number(s): "89920"
Test #41:
score: 6
Accepted
time: 2ms
memory: 20212kb
input:
10 15 6 2 1 3 5 4 8 7 9 0 3 0 10 1 5 2 4 2 10 3 6 3 9 4 6 5 7 5 8 6 7 6 9 6 10 8 10 9 10
output:
71168
result:
ok 1 number(s): "71168"
Test #42:
score: 6
Accepted
time: 0ms
memory: 22112kb
input:
10 20 3 1 2 8 6 5 4 7 9 0 4 0 5 0 10 1 2 1 5 1 6 1 9 2 4 2 10 3 5 3 6 3 7 3 9 4 8 4 10 5 9 5 10 6 7 8 9 8 10
output:
70336
result:
ok 1 number(s): "70336"
Test #43:
score: 6
Accepted
time: 0ms
memory: 22204kb
input:
10 30 6 1 2 4 3 5 9 7 8 0 1 0 2 0 4 0 5 0 6 0 7 0 9 0 10 1 2 1 3 1 6 1 7 1 8 1 10 2 6 2 8 2 10 3 4 3 5 3 6 3 10 4 6 4 10 5 6 5 7 5 8 5 10 6 8 7 9 8 10
output:
73856
result:
ok 1 number(s): "73856"
Test #44:
score: 6
Accepted
time: 0ms
memory: 18168kb
input:
10 40 8 3 1 2 7 6 4 5 9 0 1 0 2 0 3 0 4 0 7 1 2 1 3 1 5 1 6 1 7 1 9 1 10 2 3 2 5 2 6 2 7 2 8 2 9 2 10 3 4 3 5 3 6 3 7 3 10 4 6 4 8 4 9 4 10 5 7 5 8 5 9 5 10 6 7 6 8 6 9 7 8 7 9 7 10 8 10 9 10
output:
73024
result:
ok 1 number(s): "73024"
Subtask #2:
score: 18
Accepted
Dependency #1:
100%
Accepted
Test #45:
score: 18
Accepted
time: 0ms
memory: 20156kb
input:
100 1 31 25 5 3 1 2 4 17 6 9 8 7 12 10 11 16 14 13 15 18 23 21 20 19 22 24 30 29 28 27 26 38 33 32 35 34 36 37 65 59 39 45 44 42 40 41 43 52 47 46 50 49 48 51 58 57 55 54 53 56 63 61 60 62 64 99 97 90 68 66 67 86 69 76 70 73 72 71 74 75 81 78 77 80 79 84 83 82 85 87 89 88 95 94 91 92 93 96 98 38 95
output:
552106926
result:
ok 1 number(s): "552106926"
Test #46:
score: 18
Accepted
time: 0ms
memory: 20004kb
input:
100 5 68 14 10 6 5 3 1 2 4 9 8 7 13 12 11 63 41 36 30 27 15 16 17 19 18 22 21 20 23 24 25 26 29 28 34 32 31 33 35 38 37 40 39 60 48 46 42 43 45 44 47 52 49 51 50 54 53 57 55 56 58 59 62 61 66 64 65 67 97 75 74 70 69 72 71 73 76 95 80 78 77 79 90 84 83 81 82 86 85 88 87 89 93 92 91 94 96 98 99 5 62 1...
output:
413773825
result:
ok 1 number(s): "413773825"
Test #47:
score: 18
Accepted
time: 0ms
memory: 20212kb
input:
100 10 86 24 4 2 1 3 9 6 5 7 8 22 15 10 12 11 14 13 18 16 17 19 21 20 23 77 33 29 27 25 26 28 32 30 31 70 60 52 43 40 35 34 39 36 37 38 42 41 47 46 44 45 51 50 49 48 57 53 56 55 54 59 58 65 62 61 63 64 69 66 67 68 73 72 71 76 74 75 84 83 78 82 80 79 81 85 91 88 87 89 90 98 97 92 94 93 96 95 99 5 30 ...
output:
62575440
result:
ok 1 number(s): "62575440"
Test #48:
score: 18
Accepted
time: 0ms
memory: 20148kb
input:
100 100 87 47 5 2 1 3 4 27 22 16 13 12 10 9 8 6 7 11 14 15 21 17 19 18 20 24 23 25 26 28 37 32 29 30 31 35 33 34 36 41 39 38 40 45 43 42 44 46 56 50 48 49 51 53 52 55 54 60 57 59 58 77 64 62 61 63 65 66 75 70 68 67 69 73 72 71 74 76 83 79 78 81 80 82 86 84 85 96 93 89 88 90 92 91 94 95 99 97 98 1 11...
output:
409347680
result:
ok 1 number(s): "409347680"
Test #49:
score: 18
Accepted
time: 0ms
memory: 22116kb
input:
100 200 33 5 3 1 2 4 28 13 12 7 6 11 9 8 10 18 14 17 16 15 23 20 19 22 21 26 24 25 27 31 29 30 32 59 57 36 35 34 38 37 46 41 39 40 43 42 45 44 47 49 48 54 52 51 50 53 56 55 58 88 87 85 79 69 61 60 66 63 62 64 65 68 67 75 70 73 71 72 74 77 76 78 80 84 83 81 82 86 91 90 89 94 92 93 98 95 97 96 99 0 2 ...
output:
390437573
result:
ok 1 number(s): "390437573"
Test #50:
score: 18
Accepted
time: 3ms
memory: 20032kb
input:
100 300 79 29 24 12 8 3 2 1 4 5 6 7 11 10 9 19 13 17 14 16 15 18 21 20 22 23 26 25 28 27 44 41 33 32 30 31 38 37 34 35 36 39 40 43 42 70 46 45 65 47 63 58 51 48 49 50 54 53 52 56 55 57 62 61 60 59 64 66 67 69 68 75 74 71 73 72 77 76 78 95 90 80 86 85 83 81 82 84 87 89 88 92 91 93 94 97 96 98 99 0 44...
output:
819705181
result:
ok 1 number(s): "819705181"
Test #51:
score: 18
Accepted
time: 0ms
memory: 20092kb
input:
100 1000 93 57 56 11 2 1 7 5 4 3 6 8 9 10 30 12 26 25 20 18 14 13 16 15 17 19 21 24 22 23 27 29 28 35 34 31 32 33 36 45 44 37 38 43 42 39 40 41 53 49 48 47 46 51 50 52 55 54 91 78 63 60 59 58 62 61 75 71 68 64 67 66 65 70 69 74 73 72 77 76 83 81 79 80 82 86 84 85 89 87 88 90 92 99 94 98 96 95 97 0 3...
output:
750766504
result:
ok 1 number(s): "750766504"
Test #52:
score: 18
Accepted
time: 3ms
memory: 20144kb
input:
100 5050 59 44 36 35 15 7 6 2 1 3 4 5 9 8 14 12 10 11 13 26 16 20 18 17 19 23 22 21 24 25 32 27 29 28 30 31 33 34 41 39 37 38 40 43 42 45 49 46 48 47 55 50 52 51 53 54 57 56 58 65 60 61 62 64 63 67 66 84 83 72 69 68 70 71 81 75 74 73 78 76 77 80 79 82 93 85 88 86 87 89 92 90 91 96 94 95 98 97 99 0 1...
output:
331243901
result:
ok 1 number(s): "331243901"
Test #53:
score: 18
Accepted
time: 0ms
memory: 20156kb
input:
100 100 71 14 3 1 2 9 6 4 5 8 7 13 12 11 10 60 51 27 20 17 16 15 18 19 21 23 22 25 24 26 43 40 35 28 33 29 31 30 32 34 39 36 38 37 41 42 50 44 48 47 45 46 49 55 52 54 53 59 58 56 57 69 65 61 64 62 63 66 68 67 70 74 73 72 87 78 77 75 76 80 79 86 81 85 83 82 84 99 92 90 88 89 91 98 94 93 96 95 97 0 1 ...
output:
614246259
result:
ok 1 number(s): "614246259"
Test #54:
score: 18
Accepted
time: 0ms
memory: 20160kb
input:
100 100 3 2 1 96 93 5 4 90 6 11 8 7 9 10 16 15 14 12 13 21 17 18 19 20 88 26 23 22 25 24 84 27 79 29 28 33 31 30 32 37 34 36 35 38 42 40 39 41 46 45 43 44 78 76 50 47 48 49 74 73 70 66 54 51 53 52 63 55 60 58 57 56 59 61 62 65 64 67 68 69 71 72 75 77 82 81 80 83 87 86 85 89 91 92 94 95 97 98 99 0 23...
output:
663163875
result:
ok 1 number(s): "663163875"
Test #55:
score: 18
Accepted
time: 0ms
memory: 20152kb
input:
100 500 96 93 4 1 3 2 90 5 7 6 10 9 8 89 14 13 12 11 17 16 15 22 21 20 18 19 24 23 88 86 85 27 26 25 30 28 29 32 31 84 36 34 33 35 37 82 38 41 40 39 44 42 43 47 45 46 52 49 48 51 50 78 76 53 56 54 55 73 69 66 60 58 57 59 65 64 61 62 63 68 67 72 70 71 75 74 77 81 80 79 83 87 91 92 94 95 97 98 99 0 3 ...
output:
62035584
result:
ok 1 number(s): "62035584"
Subtask #3:
score: 9
Accepted
Dependency #2:
100%
Accepted
Test #56:
score: 9
Accepted
time: 2ms
memory: 20032kb
input:
500 10 457 239 205 66 2 1 33 19 6 3 5 4 8 7 10 9 12 11 17 16 15 14 13 18 25 22 21 20 23 24 28 27 26 29 32 31 30 64 54 44 39 36 34 35 37 38 43 41 40 42 49 46 45 48 47 53 51 50 52 55 58 57 56 61 60 59 62 63 65 157 135 104 83 81 78 74 70 69 68 67 73 71 72 76 75 77 79 80 82 96 93 88 84 86 85 87 90 89 91...
output:
388044595
result:
ok 1 number(s): "388044595"
Test #57:
score: 9
Accepted
time: 0ms
memory: 18064kb
input:
500 100 239 5 4 2 1 3 148 146 97 65 24 7 6 18 9 8 12 11 10 15 13 14 17 16 23 21 20 19 22 63 55 29 26 25 27 28 35 32 30 31 33 34 50 38 37 36 43 39 41 40 42 46 44 45 47 48 49 52 51 53 54 61 59 58 56 57 60 62 64 91 69 67 66 68 81 79 73 72 70 71 75 74 78 77 76 80 82 88 83 87 84 85 86 89 90 96 95 92 94 9...
output:
292284846
result:
ok 1 number(s): "292284846"
Test #58:
score: 9
Accepted
time: 0ms
memory: 20088kb
input:
500 500 62 11 1 4 2 3 10 6 5 9 8 7 44 18 12 17 16 14 13 15 21 19 20 37 35 31 30 23 22 29 28 26 24 25 27 33 32 34 36 42 40 38 39 41 43 48 46 45 47 55 54 52 51 49 50 53 61 57 56 59 58 60 152 141 130 78 72 64 63 69 65 68 67 66 71 70 75 73 74 77 76 128 85 84 80 79 83 81 82 97 91 89 86 87 88 90 93 92 96 ...
output:
118898834
result:
ok 1 number(s): "118898834"
Test #59:
score: 9
Accepted
time: 0ms
memory: 20096kb
input:
500 2000 234 206 70 5 1 4 2 3 56 42 29 15 14 12 11 7 6 9 8 10 13 26 17 16 20 18 19 22 21 24 23 25 27 28 31 30 38 37 36 33 32 35 34 40 39 41 43 50 49 48 44 45 47 46 52 51 54 53 55 62 59 58 57 60 61 69 64 63 67 66 65 68 101 82 81 75 73 71 72 74 80 78 76 77 79 87 85 83 84 86 88 95 94 90 89 91 93 92 99 ...
output:
567391097
result:
ok 1 number(s): "567391097"
Test #60:
score: 9
Accepted
time: 14ms
memory: 22144kb
input:
500 125250 36 26 9 2 1 3 7 6 5 4 8 25 22 16 15 10 12 11 13 14 21 18 17 20 19 24 23 29 27 28 35 32 31 30 34 33 80 38 37 67 42 41 40 39 48 44 43 45 46 47 62 54 50 49 52 51 53 60 59 57 55 56 58 61 65 63 64 66 74 68 71 70 69 72 73 78 76 75 77 79 100 92 89 87 82 81 85 84 83 86 88 91 90 95 93 94 96 97 98 ...
output:
882819037
result:
ok 1 number(s): "882819037"
Test #61:
score: 9
Accepted
time: 0ms
memory: 20188kb
input:
500 500 215 39 16 4 3 1 2 6 5 15 10 9 7 8 12 11 14 13 21 20 19 18 17 23 22 25 24 35 26 27 30 28 29 32 31 34 33 38 36 37 98 42 40 41 75 65 58 45 43 44 55 49 48 47 46 53 50 52 51 54 57 56 64 62 60 59 61 63 71 66 70 69 67 68 74 73 72 96 76 91 84 81 79 78 77 80 83 82 89 86 85 87 88 90 94 93 92 95 97 132...
output:
384573809
result:
ok 1 number(s): "384573809"
Test #62:
score: 9
Accepted
time: 3ms
memory: 20252kb
input:
500 500 497 1 6 5 2 3 4 7 495 492 10 8 9 12 11 491 16 15 14 13 19 18 17 20 25 21 23 22 24 487 484 479 27 26 29 28 31 30 477 475 35 34 32 33 473 37 36 40 39 38 45 44 41 42 43 47 46 469 51 49 48 50 468 55 54 52 53 59 56 57 58 466 463 462 458 454 60 63 62 61 65 64 450 449 445 67 66 68 440 72 69 70 71 4...
output:
175047909
result:
ok 1 number(s): "175047909"
Test #63:
score: 9
Accepted
time: 0ms
memory: 20056kb
input:
500 3000 497 493 5 3 2 1 4 490 485 10 6 9 8 7 15 11 12 14 13 484 16 482 20 19 18 17 479 477 475 471 469 21 466 24 22 23 465 26 25 462 30 29 28 27 458 34 32 31 33 456 35 453 449 444 40 37 36 38 39 443 45 42 41 43 44 438 434 432 48 47 46 49 50 430 426 424 55 52 51 54 53 419 57 56 58 417 414 412 62 60 ...
output:
208249623
result:
ok 1 number(s): "208249623"
Test #64:
score: 9
Accepted
time: 0ms
memory: 20060kb
input:
500 500 4 1 2 3 499 496 492 6 5 488 485 8 7 483 481 10 9 15 13 12 11 14 20 18 17 16 19 478 477 21 475 25 23 22 24 26 30 29 27 28 34 32 31 33 38 35 37 36 470 42 41 40 39 469 46 45 43 44 464 459 457 456 453 51 50 49 47 48 449 56 53 52 55 54 57 59 58 60 61 448 443 441 64 63 62 440 68 67 65 66 73 71 70 ...
output:
57890760
result:
ok 1 number(s): "57890760"
Subtask #4:
score: 17
Accepted
Dependency #3:
100%
Accepted
Test #65:
score: 17
Accepted
time: 3ms
memory: 20332kb
input:
5000 20 2811 687 23 10 8 2 1 5 4 3 7 6 9 12 11 14 13 21 16 15 20 18 17 19 22 459 394 248 96 37 32 26 25 24 30 29 27 28 31 35 33 34 36 47 43 41 40 39 38 42 45 44 46 79 63 49 48 52 50 51 56 55 53 54 62 59 58 57 61 60 75 73 67 64 66 65 70 69 68 71 72 74 77 76 78 94 84 80 82 81 83 87 85 86 89 88 90 93 9...
output:
927919648
result:
ok 1 number(s): "927919648"
Test #66:
score: 17
Accepted
time: 0ms
memory: 22296kb
input:
5000 1000 3687 2811 1266 13 6 4 1 2 3 5 11 7 9 8 10 12 850 622 93 53 52 30 19 15 14 18 17 16 27 24 23 22 21 20 26 25 29 28 40 39 32 31 38 37 36 35 34 33 42 41 51 49 45 43 44 48 46 47 50 57 54 56 55 79 75 64 62 60 59 58 61 63 71 68 66 65 67 70 69 72 74 73 78 76 77 80 84 83 82 81 92 86 85 89 87 88 91 ...
output:
965999797
result:
ok 1 number(s): "965999797"
Test #67:
score: 17
Accepted
time: 5ms
memory: 20520kb
input:
5000 5000 4909 1283 241 76 50 36 7 3 1 2 6 4 5 19 15 9 8 13 10 12 11 14 18 16 17 30 20 28 27 21 23 22 24 25 26 29 32 31 34 33 35 42 41 38 37 39 40 49 46 43 44 45 47 48 67 52 51 54 53 57 56 55 61 59 58 60 62 63 64 66 65 71 68 69 70 75 72 74 73 187 87 83 79 78 77 81 80 82 86 85 84 92 90 88 89 91 125 1...
output:
462834466
result:
ok 1 number(s): "462834466"
Test #68:
score: 17
Accepted
time: 15ms
memory: 22492kb
input:
5000 200000 3441 3112 1065 678 466 324 8 1 7 5 4 2 3 6 169 36 35 9 17 13 12 10 11 16 14 15 30 25 23 18 20 19 21 22 24 26 27 29 28 32 31 33 34 65 61 50 49 45 37 42 41 40 38 39 43 44 46 48 47 52 51 54 53 60 58 57 56 55 59 63 62 64 108 97 72 70 69 66 68 67 71 75 73 74 92 80 78 76 77 79 90 83 82 81 86 8...
output:
944502858
result:
ok 1 number(s): "944502858"
Test #69:
score: 17
Accepted
time: 6ms
memory: 23484kb
input:
5000 5000 66 60 17 3 1 2 7 5 4 6 11 9 8 10 16 14 12 13 15 31 27 21 19 18 20 25 24 22 23 26 28 29 30 47 41 36 34 32 33 35 39 38 37 40 45 42 43 44 46 58 51 49 48 50 55 53 52 54 57 56 59 61 64 63 62 65 4137 4059 874 591 308 292 118 79 77 71 69 68 67 70 76 74 73 72 75 78 81 80 103 98 86 85 82 83 84 88 8...
output:
992123431
result:
ok 1 number(s): "992123431"
Test #70:
score: 17
Accepted
time: 0ms
memory: 22420kb
input:
5000 1000 4996 4991 5 3 1 2 4 4988 6 10 9 7 8 14 12 11 13 18 15 16 17 23 22 20 19 21 4984 25 24 4980 29 27 26 28 4979 32 30 31 4974 33 4973 34 37 35 36 4968 4967 4964 41 38 39 40 4961 43 42 45 44 47 46 4959 4955 49 48 4954 50 4950 52 51 57 54 53 55 56 60 58 59 63 62 61 64 4945 4944 65 4939 69 66 68 ...
output:
942332279
result:
ok 1 number(s): "942332279"
Test #71:
score: 17
Accepted
time: 2ms
memory: 22644kb
input:
5000 5000 4997 4995 4994 4991 4 1 2 3 4989 4984 4982 4981 4979 8 7 5 6 11 9 10 16 12 13 14 15 4975 4970 19 17 18 4966 4964 20 22 21 4959 4954 23 24 4949 26 25 30 28 27 29 4948 31 34 32 33 38 37 36 35 42 39 40 41 44 43 48 47 45 46 4947 53 50 49 52 51 58 54 55 56 57 4946 4942 61 59 60 4941 4936 4932 6...
output:
458864653
result:
ok 1 number(s): "458864653"
Test #72:
score: 17
Accepted
time: 15ms
memory: 22664kb
input:
5000 200000 4997 4 1 2 3 6 5 4995 4991 10 8 7 9 4989 4986 12 11 4981 4976 4974 13 4972 14 4971 17 15 16 4970 19 18 4968 20 4965 4962 22 21 4959 25 24 23 4954 27 26 31 30 28 29 4949 33 32 4945 4944 34 38 35 37 36 40 39 4939 4936 43 42 41 4933 45 44 49 48 47 46 50 4930 54 52 51 53 55 4927 4925 59 58 5...
output:
248680221
result:
ok 1 number(s): "248680221"
Test #73:
score: 17
Accepted
time: 0ms
memory: 22624kb
input:
5000 5000 4998 4 1 2 3 8 6 5 7 4994 4993 4992 4989 4985 4983 4982 9 13 11 10 12 14 18 15 16 17 23 22 19 21 20 25 24 4978 4976 4974 4973 26 30 29 28 27 31 32 4972 4969 4968 33 4967 4962 38 35 34 36 37 43 39 40 41 42 44 4959 48 47 45 46 53 51 50 49 52 4956 4951 55 54 4950 59 58 57 56 4948 4943 62 60 6...
output:
284890525
result:
ok 1 number(s): "284890525"
Subtask #5:
score: 10
Accepted
Test #74:
score: 10
Accepted
time: 0ms
memory: 22072kb
input:
2 1 1 0 2
output:
5
result:
ok 1 number(s): "5"
Test #75:
score: 10
Accepted
time: 0ms
memory: 20148kb
input:
3 1 2 1 2 3
output:
21
result:
ok 1 number(s): "21"
Test #76:
score: 10
Accepted
time: 12ms
memory: 31436kb
input:
100000 1 94687 15935 4789 3507 2824 2099 1138 92 75 24 23 19 3 2 1 4 16 12 5 7 6 10 9 8 11 14 13 15 18 17 22 21 20 59 33 27 25 26 28 29 31 30 32 48 39 37 35 34 36 38 46 40 44 43 41 42 45 47 58 57 56 51 49 50 53 52 55 54 69 60 64 61 63 62 67 65 66 68 71 70 73 72 74 82 80 76 78 77 79 81 90 89 88 87 83...
output:
54900200
result:
ok 1 number(s): "54900200"
Test #77:
score: 10
Accepted
time: 4ms
memory: 39600kb
input:
199999 1 39981 30792 15067 5153 4932 1167 698 157 7 2 1 4 3 6 5 141 37 23 17 8 14 12 10 9 11 13 15 16 20 18 19 22 21 24 35 26 25 29 27 28 33 32 30 31 34 36 109 74 71 51 39 38 48 42 41 40 44 43 45 46 47 49 50 59 57 53 52 55 54 56 58 69 61 60 63 62 64 67 65 66 68 70 72 73 93 92 79 75 78 77 76 85 83 81...
output:
426286730
result:
ok 1 number(s): "426286730"
Test #78:
score: 10
Accepted
time: 7ms
memory: 38772kb
input:
200000 1 4305 116 59 32 3 2 1 9 6 4 5 8 7 17 14 11 10 13 12 15 16 25 21 20 19 18 24 22 23 26 31 29 27 28 30 57 45 41 39 36 35 34 33 38 37 40 44 42 43 49 46 47 48 56 53 50 51 52 54 55 58 104 86 82 72 63 61 60 62 68 67 66 65 64 70 69 71 79 78 75 73 74 77 76 81 80 84 83 85 88 87 90 89 95 94 93 91 92 10...
output:
107301064
result:
ok 1 number(s): "107301064"
Test #79:
score: 10
Accepted
time: 15ms
memory: 43344kb
input:
199999 1 2 1 4 3 199995 199994 199990 5 199988 6 199983 199980 199975 11 8 7 10 9 199970 199968 13 12 199967 17 14 16 15 22 20 18 19 21 199963 199961 27 24 23 26 25 199957 29 28 30 199955 199954 199952 199949 31 199946 199942 199941 199937 199936 33 32 37 36 35 34 199931 42 38 40 39 41 199927 199924...
output:
924406167
result:
ok 1 number(s): "924406167"
Test #80:
score: 10
Accepted
time: 18ms
memory: 45300kb
input:
200000 1 4 1 3 2 199995 7 6 5 199993 199991 199988 199985 9 8 199981 199977 10 15 14 13 11 12 199973 199972 199970 199969 199967 199965 20 16 17 18 19 199962 23 22 21 25 24 199957 29 26 28 27 32 30 31 35 33 34 199953 199950 199946 199941 199938 40 39 37 36 38 199936 199933 199931 44 42 41 43 45 46 1...
output:
527773965
result:
ok 1 number(s): "527773965"
Subtask #6:
score: 13
Accepted
Dependency #5:
100%
Accepted
Test #81:
score: 13
Accepted
time: 3ms
memory: 20144kb
input:
3 2 2 1 0 1 1 3
output:
15
result:
ok 1 number(s): "15"
Test #82:
score: 13
Accepted
time: 0ms
memory: 20148kb
input:
3 3 1 2 1 2 1 3 2 3
output:
18
result:
ok 1 number(s): "18"
Test #83:
score: 13
Accepted
time: 3ms
memory: 20084kb
input:
3 4 1 2 0 1 0 3 1 3 2 3
output:
14
result:
ok 1 number(s): "14"
Test #84:
score: 13
Accepted
time: 0ms
memory: 22204kb
input:
3 5 1 2 0 2 0 3 1 2 1 3 2 3
output:
14
result:
ok 1 number(s): "14"
Test #85:
score: 13
Accepted
time: 3ms
memory: 18112kb
input:
4 5 3 1 2 0 1 0 4 1 3 2 3 3 4
output:
48
result:
ok 1 number(s): "48"
Test #86:
score: 13
Accepted
time: 19ms
memory: 46060kb
input:
200000 2 124275 43227 4823 1132 356 148 114 13 1 9 8 5 2 3 4 6 7 10 11 12 44 20 17 15 14 16 19 18 28 25 21 23 22 24 26 27 41 40 29 34 30 33 31 32 35 37 36 38 39 43 42 106 61 48 45 47 46 51 50 49 53 52 60 58 54 55 56 57 59 100 91 66 64 62 63 65 84 71 69 68 67 70 81 77 75 72 73 74 76 80 78 79 82 83 89...
output:
182581647
result:
ok 1 number(s): "182581647"
Test #87:
score: 13
Accepted
time: 16ms
memory: 45580kb
input:
200000 3 55475 15157 4293 2033 1645 1050 649 526 402 266 109 26 8 6 1 5 2 4 3 7 22 12 9 10 11 14 13 20 19 16 15 18 17 21 25 23 24 81 36 27 33 31 28 29 30 32 34 35 45 37 41 40 38 39 44 42 43 68 50 49 47 46 48 59 54 52 51 53 58 56 55 57 65 61 60 64 63 62 67 66 75 71 69 70 73 72 74 76 78 77 79 80 100 8...
output:
43886574
result:
ok 1 number(s): "43886574"
Test #88:
score: 13
Accepted
time: 16ms
memory: 52528kb
input:
200000 4 175445 72142 54296 37617 24691 23785 12914 4994 4152 4 2 1 3 2035 409 177 136 39 21 13 8 6 5 7 11 9 10 12 16 15 14 18 17 20 19 36 23 22 27 24 25 26 30 28 29 33 32 31 34 35 37 38 131 83 80 44 40 42 41 43 53 45 51 48 46 47 49 50 52 54 77 76 66 56 55 60 57 58 59 61 62 63 64 65 71 69 67 68 70 7...
output:
498767188
result:
ok 1 number(s): "498767188"
Test #89:
score: 13
Accepted
time: 12ms
memory: 51416kb
input:
200000 5 106645 97838 57664 23376 20725 10759 1247 516 172 101 65 1 57 45 21 7 4 2 3 6 5 16 15 11 8 10 9 14 13 12 19 17 18 20 39 34 33 29 24 22 23 28 27 26 25 32 31 30 35 36 37 38 40 41 44 42 43 52 50 46 49 48 47 51 54 53 55 56 62 58 59 61 60 63 64 100 94 75 70 67 66 68 69 72 71 73 74 86 82 77 76 81...
output:
613008198
result:
ok 1 number(s): "613008198"
Test #90:
score: 13
Accepted
time: 15ms
memory: 47324kb
input:
200000 2 2 1 7 6 5 3 4 199998 12 9 8 10 11 199993 13 199990 199985 199980 17 15 14 16 19 18 20 24 22 21 23 27 26 25 28 199978 33 29 31 30 32 36 35 34 199973 39 38 37 199969 43 40 41 42 44 199968 47 45 46 52 51 50 48 49 55 53 54 58 57 56 59 60 65 64 62 61 63 67 66 199965 199963 72 68 70 69 71 76 74 7...
output:
449030945
result:
ok 1 number(s): "449030945"
Test #91:
score: 13
Accepted
time: 16ms
memory: 53356kb
input:
200000 3 2 1 199995 199993 3 199989 7 4 6 5 9 8 12 11 10 15 13 14 199985 199983 199980 19 17 16 18 199978 22 21 20 199976 199973 26 23 25 24 28 27 33 29 32 30 31 199971 199968 199963 36 34 35 199962 199959 41 37 39 38 40 42 199957 199955 199950 199949 44 43 199945 47 45 46 51 50 48 49 199941 52 1999...
output:
300585770
result:
ok 1 number(s): "300585770"
Test #92:
score: 13
Accepted
time: 19ms
memory: 57160kb
input:
200000 4 1 199996 6 4 3 2 5 8 7 11 10 9 199995 12 13 17 14 16 15 199991 19 18 199987 21 20 22 24 23 199983 199978 29 27 26 25 28 199975 199974 199970 199969 33 32 30 31 38 34 36 35 37 40 39 199966 45 42 41 44 43 48 47 46 53 49 52 50 51 54 199965 57 56 55 58 199960 60 59 199957 65 64 63 61 62 67 66 7...
output:
772992430
result:
ok 1 number(s): "772992430"
Test #93:
score: 13
Accepted
time: 19ms
memory: 55856kb
input:
200000 5 1 199995 6 5 3 2 4 199993 199989 11 9 8 7 10 199988 13 12 199986 199985 199984 14 15 199983 199979 199974 16 199969 18 17 199965 199961 199959 22 20 19 21 26 23 24 25 199955 199951 27 199950 28 199945 199940 30 29 35 33 32 31 34 39 37 36 38 199936 41 40 199931 42 199930 44 43 47 45 46 50 49...
output:
713625740
result:
ok 1 number(s): "713625740"
Subtask #7:
score: 7
Accepted
Test #94:
score: 7
Accepted
time: 3ms
memory: 20060kb
input:
2 2 1 0 1 0 2
output:
4
result:
ok 1 number(s): "4"
Test #95:
score: 7
Accepted
time: 0ms
memory: 20072kb
input:
3 3 1 2 0 1 0 2 0 3
output:
14
result:
ok 1 number(s): "14"
Test #96:
score: 7
Accepted
time: 0ms
memory: 18100kb
input:
4 4 1 2 3 0 1 0 2 0 3 0 4
output:
48
result:
ok 1 number(s): "48"
Test #97:
score: 7
Accepted
time: 2ms
memory: 18044kb
input:
10 10 8 2 1 3 4 6 5 7 9 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10
output:
71296
result:
ok 1 number(s): "71296"
Test #98:
score: 7
Accepted
time: 0ms
memory: 18116kb
input:
100 100 71 14 3 1 2 9 6 4 5 8 7 13 12 11 10 60 51 27 20 17 16 15 18 19 21 23 22 25 24 26 43 40 35 28 33 29 31 30 32 34 39 36 38 37 41 42 50 44 48 47 45 46 49 55 52 54 53 59 58 56 57 69 65 61 64 62 63 66 68 67 70 74 73 72 87 78 77 75 76 80 79 86 81 85 83 82 84 99 92 90 88 89 91 98 94 93 96 95 97 0 1 ...
output:
614246259
result:
ok 1 number(s): "614246259"
Test #99:
score: 7
Accepted
time: 3ms
memory: 22184kb
input:
1000 1000 884 218 75 24 15 11 1 8 2 3 7 6 5 4 10 9 14 13 12 17 16 23 20 18 19 22 21 41 25 28 27 26 36 31 30 29 33 32 35 34 37 38 40 39 69 51 46 44 43 42 45 50 49 47 48 57 54 53 52 56 55 65 61 58 59 60 64 62 63 66 67 68 70 73 72 71 74 201 150 140 83 79 76 78 77 81 80 82 135 102 87 86 84 85 98 91 90 8...
output:
490260340
result:
ok 1 number(s): "490260340"
Test #100:
score: 7
Accepted
time: 6ms
memory: 27072kb
input:
10000 10000 4195 1722 1337 767 660 561 320 27 8 4 1 2 3 7 5 6 15 11 10 9 12 14 13 18 16 17 19 26 24 21 20 23 22 25 164 62 52 36 29 28 34 30 31 32 33 35 45 37 42 40 38 39 41 44 43 46 50 48 47 49 51 61 53 54 60 58 55 56 57 59 109 70 64 63 69 65 68 67 66 99 73 72 71 75 74 87 85 79 78 76 77 84 80 83 82 ...
output:
875958203
result:
ok 1 number(s): "875958203"
Test #101:
score: 7
Accepted
time: 89ms
memory: 86572kb
input:
100000 100000 31189 14939 12564 1034 307 29 11 3 2 1 7 4 6 5 9 8 10 15 14 13 12 28 27 17 16 24 20 18 19 21 22 23 26 25 150 135 93 54 49 43 35 30 34 32 31 33 38 37 36 42 39 41 40 44 47 46 45 48 51 50 53 52 71 64 58 55 57 56 63 60 59 62 61 70 67 66 65 69 68 78 76 72 73 75 74 77 87 83 82 79 81 80 86 84...
output:
646402656
result:
ok 1 number(s): "646402656"
Test #102:
score: 7
Accepted
time: 177ms
memory: 156036kb
input:
199999 199999 43677 26620 24009 1060 922 441 387 12 5 3 2 1 4 10 7 6 8 9 11 201 20 14 13 17 15 16 18 19 130 29 22 21 28 23 27 26 25 24 54 46 37 33 31 30 32 36 35 34 41 38 40 39 43 42 44 45 53 50 49 47 48 51 52 55 121 78 70 66 65 64 63 60 57 56 59 58 61 62 67 68 69 75 73 71 72 74 76 77 87 84 80 79 83...
output:
459959065
result:
ok 1 number(s): "459959065"
Test #103:
score: 7
Accepted
time: 187ms
memory: 156508kb
input:
200000 200000 23147 4701 1478 883 200 73 53 52 44 42 26 5 1 4 3 2 17 12 9 8 7 6 11 10 16 13 14 15 25 21 18 19 20 22 23 24 32 27 30 28 29 31 34 33 36 35 38 37 40 39 41 43 48 45 46 47 51 50 49 65 59 56 54 55 57 58 62 61 60 63 64 68 67 66 69 70 71 72 148 76 74 75 135 131 97 78 77 83 81 79 80 82 92 86 8...
output:
121976102
result:
ok 1 number(s): "121976102"
Test #104:
score: 7
Accepted
time: 208ms
memory: 160896kb
input:
199998 199998 5 3 2 1 4 199997 199994 199989 9 6 7 8 11 10 199984 199983 199982 16 15 13 12 14 199977 199972 199967 19 17 18 199966 20 199963 199961 22 21 27 23 25 24 26 199960 30 28 29 199959 199954 32 31 33 35 34 37 36 199953 199952 38 199950 199946 199944 199939 199938 43 40 39 42 41 47 44 45 46 ...
output:
303906212
result:
ok 1 number(s): "303906212"
Test #105:
score: 7
Accepted
time: 205ms
memory: 160300kb
input:
199999 199999 5 1 2 4 3 199995 6 199993 8 7 199988 199986 199982 11 9 10 199980 199977 199972 199967 15 13 12 14 199964 16 20 17 18 19 21 199963 199962 199959 25 24 22 23 26 199958 199957 28 27 30 29 32 31 36 35 33 34 38 37 39 42 41 40 199954 199953 47 44 43 45 46 48 51 49 50 199950 55 54 53 52 1999...
output:
891471459
result:
ok 1 number(s): "891471459"
Test #106:
score: 7
Accepted
time: 195ms
memory: 160904kb
input:
200000 200000 199998 199995 199994 199993 5 1 2 3 4 199989 7 6 199985 199980 199976 199975 199973 199972 199970 199968 10 9 8 13 12 11 199967 199962 199961 199956 199954 199950 199949 16 14 15 199947 18 17 22 20 19 21 199943 26 23 24 25 199941 199936 199932 199928 28 27 199924 199922 199921 29 19992...
output:
228098903
result:
ok 1 number(s): "228098903"
Test #107:
score: 7
Accepted
time: 8ms
memory: 27336kb
input:
13327 13327 13326 6663 6185 3092 1546 773 386 193 96 48 24 12 6 3 1 2 4 5 9 7 8 10 11 18 15 13 14 16 17 21 19 20 22 23 36 30 27 25 26 28 29 33 31 32 34 35 42 39 37 38 40 41 45 43 44 46 47 72 60 54 51 49 50 52 53 57 55 56 58 59 66 63 61 62 64 65 69 67 68 70 71 84 78 75 73 74 76 77 81 79 80 82 83 90 8...
output:
903762303
result:
ok 1 number(s): "903762303"
Test #108:
score: 7
Accepted
time: 10ms
memory: 29296kb
input:
13327 13327 13326 6663 6185 3092 1546 773 386 193 96 48 24 12 6 1 2 3 4 5 9 7 8 10 11 18 15 13 14 16 17 21 19 20 22 23 36 30 27 25 26 28 29 33 31 32 34 35 42 39 37 38 40 41 45 43 44 46 47 72 60 54 51 49 50 52 53 57 55 56 58 59 66 63 61 62 64 65 69 67 68 70 71 84 78 75 73 74 76 77 81 79 80 82 83 90 8...
output:
677206413
result:
ok 1 number(s): "677206413"
Test #109:
score: 7
Accepted
time: 8ms
memory: 27340kb
input:
13326 13326 6663 6185 3092 1546 773 386 193 96 48 24 12 6 3 1 2 4 5 9 7 8 10 11 18 15 13 14 16 17 21 19 20 22 23 36 30 27 25 26 28 29 33 31 32 34 35 42 39 37 38 40 41 45 43 44 46 47 72 60 54 51 49 50 52 53 57 55 56 58 59 66 63 61 62 64 65 69 67 68 70 71 84 78 75 73 74 76 77 81 79 80 82 83 90 87 85 8...
output:
0
result:
ok 1 number(s): "0"
Subtask #8:
score: 20
Accepted
Dependency #4:
100%
Accepted
Dependency #6:
100%
Accepted
Dependency #7:
100%
Accepted
Test #110:
score: 20
Accepted
time: 23ms
memory: 27068kb
input:
10000 200000 461 103 46 4 2 1 3 43 15 5 7 6 13 8 11 9 10 12 14 36 20 17 16 19 18 32 27 25 21 22 24 23 26 30 29 28 31 35 34 33 42 41 38 37 39 40 44 45 86 68 55 54 52 48 47 50 49 51 53 60 59 58 56 57 61 63 62 64 65 66 67 83 77 69 76 75 72 71 70 73 74 79 78 82 81 80 84 85 90 87 89 88 94 92 91 93 101 95...
output:
406238058
result:
ok 1 number(s): "406238058"
Test #111:
score: 20
Accepted
time: 84ms
memory: 87004kb
input:
100000 200000 80572 52725 39147 13136 10126 1640 134 61 38 20 4 2 1 3 10 8 7 6 5 9 11 19 12 18 13 16 14 15 17 35 25 21 24 23 22 26 28 27 29 30 31 33 32 34 36 37 52 43 40 39 42 41 50 49 47 46 44 45 48 51 58 56 55 54 53 57 60 59 112 64 62 63 86 85 67 65 66 74 73 72 71 68 70 69 78 77 76 75 83 82 80 79 ...
output:
112475316
result:
ok 1 number(s): "112475316"
Test #112:
score: 20
Accepted
time: 33ms
memory: 59088kb
input:
200000 10 30854 5167 4255 907 815 721 350 119 118 67 43 1 29 12 3 2 10 9 5 4 8 7 6 11 19 13 14 17 15 16 18 20 25 21 24 22 23 27 26 28 40 34 33 32 30 31 35 38 37 36 39 41 42 47 46 45 44 56 49 48 53 52 51 50 55 54 58 57 63 60 59 62 61 66 65 64 103 72 69 68 70 71 86 74 73 80 76 75 77 78 79 83 81 82 84 ...
output:
245341633
result:
ok 1 number(s): "245341633"
Test #113:
score: 20
Accepted
time: 25ms
memory: 67664kb
input:
200000 20 29031 24947 12635 6350 5630 5077 4412 1230 1194 455 215 137 115 67 43 3 1 2 28 17 6 5 4 16 12 10 8 7 9 11 13 14 15 23 20 19 18 21 22 25 24 26 27 41 32 31 30 29 39 36 33 35 34 37 38 40 42 63 57 53 47 46 44 45 50 49 48 52 51 55 54 56 58 60 59 61 62 66 65 64 90 71 68 69 70 77 72 74 73 75 76 8...
output:
326899139
result:
ok 1 number(s): "326899139"
Test #114:
score: 20
Accepted
time: 30ms
memory: 73960kb
input:
200000 50 157867 111962 29766 13620 12379 10622 9272 1468 623 100 23 12 5 2 1 4 3 8 7 6 9 10 11 19 16 13 15 14 17 18 22 21 20 67 56 41 33 26 24 25 27 30 28 29 31 32 38 35 34 37 36 40 39 54 53 47 45 43 42 44 46 51 49 48 50 52 55 62 61 58 57 59 60 64 63 66 65 90 85 68 84 75 71 69 70 73 72 74 80 77 76 ...
output:
565344166
result:
ok 1 number(s): "565344166"
Test #115:
score: 20
Accepted
time: 23ms
memory: 82208kb
input:
200000 100 24471 5360 3862 396 284 138 22 3 2 1 16 4 9 7 5 6 8 13 10 12 11 15 14 20 17 19 18 21 127 51 39 33 30 23 29 25 24 27 26 28 32 31 37 36 35 34 38 42 40 41 46 44 43 45 47 48 49 50 91 83 62 53 52 59 55 54 58 57 56 60 61 74 72 63 66 64 65 69 67 68 70 71 73 77 75 76 80 78 79 81 82 90 87 84 86 85...
output:
56996486
result:
ok 1 number(s): "56996486"
Test #116:
score: 20
Accepted
time: 40ms
memory: 87416kb
input:
200000 200 56711 47863 41971 22386 17492 4152 1271 612 550 375 317 279 167 10 6 3 1 2 5 4 7 8 9 89 66 15 12 11 13 14 60 45 35 20 19 16 18 17 25 24 23 22 21 32 31 30 29 27 26 28 33 34 40 37 36 38 39 43 42 41 44 59 47 46 58 52 51 48 49 50 57 55 53 54 56 65 62 61 63 64 80 70 67 69 68 76 74 71 72 73 75 ...
output:
335141608
result:
ok 1 number(s): "335141608"
Test #117:
score: 20
Accepted
time: 43ms
memory: 96084kb
input:
200000 500 142203 48936 22845 22275 15156 10452 6047 1908 801 322 195 172 23 20 7 2 1 5 4 3 6 12 10 9 8 11 13 16 15 14 18 17 19 22 21 27 24 26 25 82 53 46 42 40 37 31 29 28 30 36 34 33 32 35 38 39 41 44 43 45 47 52 51 50 49 48 72 55 54 59 57 56 58 61 60 71 67 64 62 63 66 65 70 68 69 77 74 73 75 76 8...
output:
837766124
result:
ok 1 number(s): "837766124"
Test #118:
score: 20
Accepted
time: 54ms
memory: 102040kb
input:
200000 1000 99940 83118 32838 29563 28568 18514 1937 1612 482 353 44 18 2 1 4 3 9 7 6 5 8 10 13 11 12 17 15 14 16 20 19 33 28 27 23 22 21 25 24 26 30 29 32 31 40 39 37 35 34 36 38 42 41 43 86 49 47 45 46 48 79 50 72 65 58 57 53 51 52 54 56 55 64 59 62 60 61 63 68 66 67 69 70 71 75 74 73 76 78 77 85 ...
output:
976889971
result:
ok 1 number(s): "976889971"
Test #119:
score: 20
Accepted
time: 35ms
memory: 123460kb
input:
200000 10000 11819 5742 3664 3200 791 411 7 6 1 3 2 4 5 184 58 41 20 14 8 9 13 11 10 12 17 15 16 18 19 28 24 23 22 21 27 25 26 29 33 32 30 31 35 34 36 40 38 37 39 45 43 42 44 54 53 52 46 48 47 51 50 49 55 57 56 155 86 75 67 63 60 59 62 61 65 64 66 71 68 69 70 74 72 73 84 82 78 76 77 81 79 80 83 85 1...
output:
159288979
result:
ok 1 number(s): "159288979"
Test #120:
score: 20
Accepted
time: 77ms
memory: 129208kb
input:
200000 20000 72970 42061 7644 5479 606 489 26 18 14 7 2 1 6 4 3 5 9 8 12 10 11 13 15 16 17 25 20 19 21 22 24 23 169 99 56 45 40 30 29 27 28 33 32 31 38 37 35 34 36 39 41 44 42 43 49 46 48 47 50 54 51 53 52 55 84 69 63 60 57 58 59 61 62 66 65 64 68 67 79 74 72 71 70 73 76 75 78 77 81 80 83 82 97 91 8...
output:
185731487
result:
ok 1 number(s): "185731487"
Test #121:
score: 20
Accepted
time: 108ms
memory: 140584kb
input:
200000 50000 158723 150744 3080 2212 725 85 73 3 2 1 49 26 4 5 14 12 9 6 7 8 10 11 13 24 17 15 16 23 18 19 22 20 21 25 39 27 36 35 34 30 28 29 32 31 33 38 37 42 41 40 44 43 47 45 46 48 67 57 52 51 50 54 53 55 56 63 62 59 58 61 60 66 64 65 70 69 68 72 71 76 75 74 81 78 77 79 80 84 83 82 379 211 157 9...
output:
145898857
result:
ok 1 number(s): "145898857"
Test #122:
score: 20
Accepted
time: 146ms
memory: 146984kb
input:
200000 100000 83103 18085 6593 1139 322 320 225 97 60 21 8 1 6 5 4 2 3 7 9 18 10 14 13 11 12 16 15 17 19 20 56 49 39 27 25 24 22 23 26 31 28 30 29 32 33 35 34 38 36 37 42 41 40 48 46 44 43 45 47 52 51 50 53 54 55 57 58 59 79 74 64 62 61 63 68 65 67 66 73 71 69 70 72 76 75 77 78 92 85 80 84 82 81 83 ...
output:
146686318
result:
ok 1 number(s): "146686318"
Test #123:
score: 20
Accepted
time: 187ms
memory: 153596kb
input:
199999 200000 148657 5359 2416 1471 777 736 145 139 108 85 79 44 38 22 14 11 10 2 1 5 4 3 8 7 6 9 13 12 20 16 15 17 19 18 21 33 25 23 24 32 30 28 27 26 29 31 35 34 37 36 43 40 39 42 41 67 58 51 47 45 46 49 48 50 54 53 52 57 55 56 59 65 60 62 61 63 64 66 77 68 72 69 70 71 76 75 74 73 78 82 80 81 83 8...
output:
160174881
result:
ok 1 number(s): "160174881"
Test #124:
score: 20
Accepted
time: 186ms
memory: 153188kb
input:
200000 199999 28800 24159 19396 17100 2062 1885 91 55 12 6 3 1 2 4 5 10 7 8 9 11 39 18 13 17 14 15 16 30 25 24 22 20 19 21 23 28 26 27 29 36 34 31 32 33 35 38 37 50 44 43 40 41 42 49 47 45 46 48 51 52 53 54 63 56 57 61 58 59 60 62 78 77 67 65 64 66 75 71 70 68 69 74 72 73 76 88 80 79 83 82 81 86 84 ...
output:
269759742
result:
ok 1 number(s): "269759742"
Test #125:
score: 20
Accepted
time: 180ms
memory: 152672kb
input:
200000 200000 107152 2973 2450 1482 1319 216 29 19 7 5 3 2 1 4 6 16 8 9 15 12 10 11 14 13 18 17 21 20 26 25 22 23 24 28 27 146 88 58 39 35 34 33 32 31 30 37 36 38 49 42 40 41 46 43 44 45 48 47 52 51 50 54 53 55 57 56 73 70 69 62 61 59 60 64 63 66 65 67 68 71 72 80 79 75 74 77 76 78 86 82 81 83 85 84...
output:
17504745
result:
ok 1 number(s): "17504745"
Test #126:
score: 20
Accepted
time: 20ms
memory: 27236kb
input:
10000 200000 9999 9994 5 4 3 1 2 6 9992 11 10 9 7 8 13 12 9991 9987 17 15 14 16 9984 9982 9981 9979 9975 9970 9965 21 18 20 19 26 22 25 23 24 9960 31 29 28 27 30 36 34 33 32 35 9959 9954 9953 9949 9944 38 37 42 40 39 41 46 45 44 43 47 9940 48 50 49 55 54 51 53 52 9938 57 56 59 58 62 61 60 66 63 64 6...
output:
360321326
result:
ok 1 number(s): "360321326"
Test #127:
score: 20
Accepted
time: 88ms
memory: 90448kb
input:
100000 200000 3 1 2 99995 99994 6 5 4 99989 99987 99982 99980 99976 11 7 8 10 9 99975 12 99974 13 16 14 15 99972 19 17 18 23 22 20 21 99968 99967 99964 99959 28 25 24 26 27 32 31 29 30 99957 99955 99953 34 33 39 37 36 35 38 40 42 41 99952 99951 99949 99944 46 44 43 45 49 48 47 50 51 52 57 56 54 53 5...
output:
110743646
result:
ok 1 number(s): "110743646"
Test #128:
score: 20
Accepted
time: 24ms
memory: 66116kb
input:
200000 10 3 1 2 199997 5 4 199995 8 6 7 10 9 11 199994 199992 199990 199988 199985 16 12 13 15 14 18 17 20 19 199981 24 21 23 22 199980 27 26 25 28 199979 199976 199973 199970 31 29 30 36 33 32 35 34 37 39 38 199967 42 41 40 199965 43 199960 199955 44 48 46 45 47 52 49 50 51 199953 199948 55 53 54 6...
output:
903009002
result:
ok 1 number(s): "903009002"
Test #129:
score: 20
Accepted
time: 15ms
memory: 71396kb
input:
200000 20 3 2 1 4 5 9 8 6 7 14 11 10 12 13 16 15 18 17 19 199998 199996 199995 24 21 20 22 23 27 26 25 28 199990 30 29 32 31 199988 37 33 35 34 36 199986 199985 199984 39 38 43 40 42 41 199979 199977 199973 199971 47 44 45 46 199967 51 48 49 50 55 52 53 54 60 58 56 57 59 199964 199963 62 61 63 67 64...
output:
78340456
result:
ok 1 number(s): "78340456"
Test #130:
score: 20
Accepted
time: 31ms
memory: 80696kb
input:
200000 50 5 1 4 3 2 9 6 8 7 12 10 11 199999 15 13 14 19 16 17 18 20 199997 199993 24 22 21 23 199988 199985 199980 199978 25 28 26 27 199975 29 33 32 30 31 199970 199967 37 35 34 36 42 39 38 41 40 45 44 43 199964 199963 199960 47 46 199955 48 199953 199948 53 52 51 50 49 58 56 54 55 57 59 199945 199...
output:
997438867
result:
ok 1 number(s): "997438867"
Test #131:
score: 20
Accepted
time: 36ms
memory: 85348kb
input:
200000 100 199997 1 3 2 7 6 5 4 12 11 9 8 10 13 14 199995 17 16 15 18 199991 199988 199985 199982 20 19 199980 23 21 22 199975 199972 199970 199968 27 25 24 26 199964 199961 30 28 29 35 34 31 33 32 39 38 37 36 43 40 41 42 44 199957 199954 199952 199949 45 49 48 47 46 53 52 51 50 199948 56 54 55 58 5...
output:
751622484
result:
ok 1 number(s): "751622484"
Test #132:
score: 20
Accepted
time: 48ms
memory: 92972kb
input:
200000 200 199995 199991 199990 199985 199980 199977 199975 199970 3 1 2 7 6 5 4 199967 9 8 199964 199959 10 199957 199952 199951 12 11 16 14 13 15 17 19 18 199949 199945 199944 199942 199939 21 20 22 199934 199933 24 23 199929 199924 199922 199919 26 25 199918 29 27 28 34 31 30 32 33 199913 37 36 3...
output:
699912733
result:
ok 1 number(s): "699912733"
Test #133:
score: 20
Accepted
time: 51ms
memory: 101084kb
input:
200000 500 3 1 2 8 4 5 7 6 13 11 10 9 12 18 17 16 15 14 199999 199995 19 199993 20 21 23 22 24 29 26 25 28 27 31 30 33 32 199988 199984 199982 37 36 34 35 199981 199980 199977 199973 41 38 39 40 42 199972 199968 199966 45 43 44 199962 50 47 46 48 49 54 52 51 53 56 55 58 57 61 60 59 199957 66 64 62 6...
output:
754861231
result:
ok 1 number(s): "754861231"
Test #134:
score: 20
Accepted
time: 51ms
memory: 107028kb
input:
200000 1000 199996 199995 3 1 2 199991 6 5 4 11 9 7 8 10 199988 199983 199978 13 12 199974 199970 199969 199965 14 199964 16 15 17 21 19 18 20 199963 26 22 23 25 24 27 199960 199955 30 28 29 34 31 33 32 199950 199946 37 35 36 199942 199940 199935 199934 199933 39 38 199932 43 40 41 42 44 46 45 49 47...
output:
846865308
result:
ok 1 number(s): "846865308"
Test #135:
score: 20
Accepted
time: 73ms
memory: 129568kb
input:
200000 10000 199996 199991 199988 199983 3 2 1 199981 199979 6 4 5 9 7 8 14 12 11 10 13 199978 199977 199974 199972 19 18 15 17 16 199967 199963 199958 24 22 20 21 23 199954 27 25 26 31 30 29 28 33 32 199952 36 34 35 199951 38 37 40 39 43 41 42 199949 48 47 45 44 46 50 49 51 199945 52 53 58 57 54 55...
output:
658784652
result:
ok 1 number(s): "658784652"
Test #136:
score: 20
Accepted
time: 73ms
memory: 135804kb
input:
200000 20000 4 1 2 3 8 7 5 6 13 9 12 10 11 199997 14 16 15 199996 20 19 18 17 22 21 25 24 23 29 27 26 28 199993 32 31 30 199989 37 33 35 34 36 199988 40 39 38 44 41 43 42 48 45 47 46 199985 199982 199978 50 49 199974 54 52 51 53 199969 55 60 58 57 56 59 65 63 62 61 64 70 69 67 66 68 199968 73 71 72 ...
output:
392055844
result:
ok 1 number(s): "392055844"
Test #137:
score: 20
Accepted
time: 109ms
memory: 145544kb
input:
200000 50000 199998 199996 4 3 2 1 199995 199994 199991 199987 199985 5 7 6 199984 199979 8 199975 10 9 199970 199969 15 13 12 11 14 199968 17 16 20 18 19 22 21 27 24 23 26 25 31 30 28 29 199966 199962 36 32 33 35 34 38 37 41 39 40 199961 46 44 42 43 45 199958 51 48 47 50 49 199955 199952 199950 199...
output:
74961467
result:
ok 1 number(s): "74961467"
Test #138:
score: 20
Accepted
time: 131ms
memory: 151552kb
input:
200000 100000 5 4 3 2 1 199998 10 9 8 7 6 13 12 11 15 14 199996 199995 199991 19 18 17 16 199990 21 20 23 22 24 199989 27 25 26 199984 29 28 199980 199976 199974 199972 34 33 32 31 30 199971 199970 35 199966 39 36 38 37 43 40 42 41 47 46 45 44 49 48 54 50 53 51 52 199964 59 55 58 57 56 199960 199956...
output:
27019826
result:
ok 1 number(s): "27019826"
Test #139:
score: 20
Accepted
time: 193ms
memory: 158856kb
input:
199999 200000 199994 3 2 1 7 6 5 4 199993 199988 199984 199980 12 9 8 10 11 14 13 199977 199974 17 16 15 199969 199965 199964 18 199963 23 20 19 21 22 199960 28 25 24 27 26 199956 33 32 29 30 31 35 34 199953 40 36 39 38 37 199950 199948 199944 44 41 43 42 199941 45 50 49 46 47 48 52 51 56 54 53 55 5...
output:
10648822
result:
ok 1 number(s): "10648822"
Test #140:
score: 20
Accepted
time: 171ms
memory: 158936kb
input:
200000 199999 199996 199994 2 1 199993 6 3 5 4 9 7 8 11 10 14 12 13 199989 199986 15 199982 199980 18 17 16 199979 199974 199973 19 199971 23 20 21 22 199966 199961 199957 199955 199952 199949 26 25 24 27 199944 29 28 31 30 35 32 33 34 39 36 37 38 199942 41 40 199938 199936 199935 46 44 43 42 45 51 ...
output:
184259513
result:
ok 1 number(s): "184259513"
Test #141:
score: 20
Accepted
time: 185ms
memory: 157936kb
input:
200000 200000 1 4 3 2 5 7 6 199997 199995 9 8 199990 199985 14 13 12 10 11 15 199984 17 16 19 18 21 20 25 24 22 23 199982 30 29 28 27 26 35 33 32 31 34 199979 199976 199975 199973 40 38 37 36 39 199971 45 43 42 41 44 199970 199967 199963 199961 46 47 48 199958 199955 50 49 55 53 51 52 54 199954 59 5...
output:
214366829
result:
ok 1 number(s): "214366829"
Test #142:
score: 20
Accepted
time: 20ms
memory: 25872kb
input:
10000 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:
574245653
result:
ok 1 number(s): "574245653"
Test #143:
score: 20
Accepted
time: 118ms
memory: 93936kb
input:
100000 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:
35727732
result:
ok 1 number(s): "35727732"
Test #144:
score: 20
Accepted
time: 172ms
memory: 168824kb
input:
199999 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:
863354849
result:
ok 1 number(s): "863354849"
Test #145:
score: 20
Accepted
time: 165ms
memory: 161720kb
input:
200000 100000 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:
211532409
result:
ok 1 number(s): "211532409"
Test #146:
score: 20
Accepted
time: 179ms
memory: 167732kb
input:
200000 199999 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:
826464901
result:
ok 1 number(s): "826464901"
Test #147:
score: 20
Accepted
time: 181ms
memory: 168044kb
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:
32596084
result:
ok 1 number(s): "32596084"
Test #148:
score: 20
Accepted
time: 24ms
memory: 24980kb
input:
10000 200000 5000 2500 1250 625 312 156 78 39 19 9 4 2 1 3 6 5 7 8 14 11 10 12 13 16 15 17 18 29 24 21 20 22 23 26 25 27 28 34 31 30 32 33 36 35 37 38 58 48 43 41 40 42 45 44 46 47 53 50 49 51 52 55 54 56 57 68 63 60 59 61 62 65 64 66 67 73 70 69 71 72 75 74 76 77 117 97 87 82 80 79 81 84 83 85 86 9...
output:
956214004
result:
ok 1 number(s): "956214004"
Test #149:
score: 20
Accepted
time: 95ms
memory: 86252kb
input:
100000 200000 50000 25000 12500 6250 3125 1562 781 390 195 97 48 24 12 6 3 1 2 4 5 9 7 8 10 11 18 15 13 14 16 17 21 19 20 22 23 36 30 27 25 26 28 29 33 31 32 34 35 42 39 37 38 40 41 45 43 44 46 47 72 60 54 51 49 50 52 53 57 55 56 58 59 66 63 61 62 64 65 69 67 68 70 71 84 78 75 73 74 76 77 81 79 80 8...
output:
266826161
result:
ok 1 number(s): "266826161"
Test #150:
score: 20
Accepted
time: 172ms
memory: 153884kb
input:
199999 200000 99999 49999 24999 12499 6249 3124 1562 781 390 195 97 48 24 12 6 3 1 2 4 5 9 7 8 10 11 18 15 13 14 16 17 21 19 20 22 23 36 30 27 25 26 28 29 33 31 32 34 35 42 39 37 38 40 41 45 43 44 46 47 72 60 54 51 49 50 52 53 57 55 56 58 59 66 63 61 62 64 65 69 67 68 70 71 84 78 75 73 74 76 77 81 7...
output:
243676944
result:
ok 1 number(s): "243676944"
Test #151:
score: 20
Accepted
time: 141ms
memory: 147772kb
input:
200000 100000 100000 50000 25000 12500 6250 3125 1562 781 390 195 97 48 24 12 6 3 1 2 4 5 9 7 8 10 11 18 15 13 14 16 17 21 19 20 22 23 36 30 27 25 26 28 29 33 31 32 34 35 42 39 37 38 40 41 45 43 44 46 47 72 60 54 51 49 50 52 53 57 55 56 58 59 66 63 61 62 64 65 69 67 68 70 71 84 78 75 73 74 76 77 81 ...
output:
540781544
result:
ok 1 number(s): "540781544"
Test #152:
score: 20
Accepted
time: 179ms
memory: 153060kb
input:
200000 199999 100000 50000 25000 12500 6250 3125 1562 781 390 195 97 48 24 12 6 3 1 2 4 5 9 7 8 10 11 18 15 13 14 16 17 21 19 20 22 23 36 30 27 25 26 28 29 33 31 32 34 35 42 39 37 38 40 41 45 43 44 46 47 72 60 54 51 49 50 52 53 57 55 56 58 59 66 63 61 62 64 65 69 67 68 70 71 84 78 75 73 74 76 77 81 ...
output:
27359347
result:
ok 1 number(s): "27359347"
Test #153:
score: 20
Accepted
time: 164ms
memory: 153164kb
input:
200000 200000 100000 50000 25000 12500 6250 3125 1562 781 390 195 97 48 24 12 6 3 1 2 4 5 9 7 8 10 11 18 15 13 14 16 17 21 19 20 22 23 36 30 27 25 26 28 29 33 31 32 34 35 42 39 37 38 40 41 45 43 44 46 47 72 60 54 51 49 50 52 53 57 55 56 58 59 66 63 61 62 64 65 69 67 68 70 71 84 78 75 73 74 76 77 81 ...
output:
754017498
result:
ok 1 number(s): "754017498"
Test #154:
score: 20
Accepted
time: 7ms
memory: 29236kb
input:
13327 13326 13326 6663 6185 3092 1546 773 386 193 96 48 24 12 6 3 1 2 4 5 9 7 8 10 11 18 15 13 14 16 17 21 19 20 22 23 36 30 27 25 26 28 29 33 31 32 34 35 42 39 37 38 40 41 45 43 44 46 47 72 60 54 51 49 50 52 53 57 55 56 58 59 66 63 61 62 64 65 69 67 68 70 71 84 78 75 73 74 76 77 81 79 80 82 83 90 8...
output:
0
result:
ok 1 number(s): "0"
Test #155:
score: 20
Accepted
time: 10ms
memory: 31420kb
input:
13328 13327 13327 13326 6663 6185 3092 1546 773 386 193 96 48 24 12 6 1 2 3 4 5 9 7 8 10 11 18 15 13 14 16 17 21 19 20 22 23 36 30 27 25 26 28 29 33 31 32 34 35 42 39 37 38 40 41 45 43 44 46 47 72 60 54 51 49 50 52 53 57 55 56 58 59 66 63 61 62 64 65 69 67 68 70 71 84 78 75 73 74 76 77 81 79 80 82 8...
output:
551817976
result:
ok 1 number(s): "551817976"
Test #156:
score: 20
Accepted
time: 7ms
memory: 28024kb
input:
13328 13327 13327 13326 6663 6185 3092 1546 773 386 193 96 48 24 12 6 3 1 2 4 5 9 7 8 10 11 18 15 13 14 16 17 21 19 20 22 23 36 30 27 25 26 28 29 33 31 32 34 35 42 39 37 38 40 41 45 43 44 46 47 72 60 54 51 49 50 52 53 57 55 56 58 59 66 63 61 62 64 65 69 67 68 70 71 84 78 75 73 74 76 77 81 79 80 82 8...
output:
573075128
result:
ok 1 number(s): "573075128"