QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#462196#4564. Digital Circuitq258233q52 121ms55868kbC++143.0kb2024-07-03 15:30:262024-07-03 15:30:27

Judging History

你现在查看的是最新测评结果

  • [2024-07-03 15:30:27]
  • 评测
  • 测评结果:52
  • 用时:121ms
  • 内存:55868kb
  • [2024-07-03 15:30:26]
  • 提交

answer

#include "circuit.h"

#include <vector>
#include<bits/stdc++.h>

namespace Sol{

using namespace std;
using ll=long long;
using u64=unsigned long long;
//using lll=__int128_t;
using lf=long double;
using Pr=pair<int,int>;
#define F(i,l,r) for(ll i=l;i<=ll(r);++i)
#define G(i,r,l) for(ll i=r;i>=ll(l);--i)
#define ct const
#define il inline
#define pb push_back
#define fi first
#define se second
#define mkr make_pair
template<class T>
il void tomn(T&x,T ct&y){y<x?x=y,0:0;}
template<class T>
il void tomx(T&x,T ct&y){x<y?x=y,0:0;}
#define dbg(...) fprintf(stderr,__VA_ARGS__)
#define CUT dbg("===================\n")
ct lf EPS=1e-10L;
il int dcmp(lf x){return fabs(x)<=EPS?0:(x<0?-1:1);}
ct ll INF=4e18L;
//ct int INF=1.02e9;
//il void rd(int&x){scanf("%d",&x);}
//il void rd(ll&x){scanf("%lld",&x);}

ct ll P=1000002022;
void add2(ll&x,ll y){x+=y,x-=((-(x>=P))&P);}
void sub2(ll&x,ll y){x-=y,x+=((-(x<0))&P);}
ll add(ll x,ll y){return add2(x,y),x;}
ll sub(ll x,ll y){return sub2(x,y),x;}

ct int N=4.02e5;

struct D{ll s,x;};
D operator*(D x,D y){return D{x.s+y.s,x.x+y.x};}
class SGT{
	struct Node{ll s,x;int tg;}d[4*N];
#define L (p<<1)
#define R (L|1)
	void up(int p){
		d[p].x=add(d[L].x,d[R].x);
	}
	void upd(int p){d[p].x=sub(d[p].s,d[p].x),d[p].tg^=1;}
	void push(int p){
		if(d[p].tg)upd(L),upd(R),d[p].tg=0;
	}
	int l,r;
	void upd(int p,int s,int t){
		if(l<=s&&t<=r)return upd(p);
		int mid=(s+t)>>1;push(p);
		if(l<=mid)upd(L,s,mid);
		if(mid<r)upd(R,mid+1,t);
		up(p);
	}
	void build(int p,int s,int t,ll*a,int*b){
		d[p].tg=0;
		if(s==t){
//			dbg("%d:	%lld	%lld\n",s,a[s],b[s]*a[s]);
			return d[p]=Node{a[s],b[s]*a[s]},void();
		}
		int mid=(s+t)>>1;
		build(L,s,mid,a,b);
		build(R,mid+1,t,a,b);
		d[p].s=add(d[L].s,d[R].s);
//		d[p].s=d[L].s+d[R].s;
		up(p);
	}
public:
	int n;
	void build(int n_,ll*a,int*b){build(1,1,n=n_,a,b);}
	void upd(int l_,int r_){
		l=l_,r=r_,upd(1,1,n);
	}
	ll qry(){return d[1].x;}
#undef L
#undef R
}sgt;

int n,m,fa[N],a[N];
ll f[N],g[N];
vector<int>t[N];
void dfs(int u){
	int n=t[u].size();
	vector<ll>pre(n,1),suf(n,1);
	F(i,0,n-2)pre[i+1]=pre[i]*g[t[u][i]];
	G(i,n-1,1)suf[i-1]=suf[i]*g[t[u][i]];
	F(i,0,n-1)
		f[t[u][i]]=f[u]*pre[i]%P*suf[i]%P,dfs(t[u][i]);
}
void init(){
	F(i,1,n+m)f[i]=g[i]=1,t[fa[i]].pb(i);
	G(i,n,1)(g[i]*=t[i].size())%=P,(g[fa[i]]*=g[i])%=P;
	dfs(1);
	
//	dbg("fa:	");
//	F(i,1,n+m)dbg("%d ",fa[i]);
//	dbg("\n");
//	dbg("g:	");
//	F(i,1,n+m)dbg("%lld ",g[i]);
//	dbg("\n");
//	dbg("f:	");
//	F(i,1,n+m)dbg("%lld ",f[i]);
//	dbg("\n");
//	dbg("a:	");
//	F(i,1,m)dbg("%d ",a[i]);
//	dbg("\n");
	
	sgt.build(m,f+n,a);
}
ll qry(int l,int r){
	return sgt.upd(l-n,r-n),sgt.qry();
}

}//namespace Sol

void init(int N, int M, std::vector<int> P, std::vector<int> A) {
	using namespace Sol;
	n=N,m=M;
	F(i,1,n+m)fa[i]=P[i-1]+1;
	F(i,1,m)a[i]=A[i-1];
	init();
}

int count_ways(int L, int R) {
  return Sol::qry(L+1,R+1);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 2
Accepted

Test #1:

score: 2
Accepted
time: 2ms
memory: 21616kb

input:

1 2
-1 0 0
0 0
1 1
2 2
1 2
2 2
1 2
-1 -1
-2 -2

output:

1
2
0
1
1

result:

ok 7 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 21216kb

input:

1 1
-1 0
0
1 1
1 1
1 1
1 1
-1 -1
-2 -2

output:

1
0
1
0

result:

ok 6 lines

Test #3:

score: 0
Accepted
time: 4ms
memory: 21552kb

input:

1 972
-1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

509
483
489
500
481

result:

ok 7 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 22464kb

input:

1 1000
-1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

4
40
428
262
237

result:

ok 7 lines

Test #5:

score: 0
Accepted
time: 4ms
memory: 21380kb

input:

1 1000
-1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

898
828
828
617
582

result:

ok 7 lines

Test #6:

score: 0
Accepted
time: 4ms
memory: 21128kb

input:

1 1000
-1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

535
494
500
498
509

result:

ok 7 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 22984kb

input:

1 1000
-1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

517
486
511
487
512

result:

ok 7 lines

Test #8:

score: 0
Accepted
time: 0ms
memory: 21444kb

input:

1 1000
-1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

501
500
499
500
501

result:

ok 7 lines

Subtask #2:

score: 7
Accepted

Test #9:

score: 7
Accepted
time: 3ms
memory: 22564kb

input:

1 2
-1 0 0
0 0
1 1
2 2
1 2
2 2
1 2
-1 -1
-2 -2

output:

1
2
0
1
1

result:

ok 7 lines

Test #10:

score: 0
Accepted
time: 3ms
memory: 22212kb

input:

255 256
-1 0 0 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 ...

output:

52130940
785285606
585825652

result:

ok 5 lines

Test #11:

score: 0
Accepted
time: 2ms
memory: 21420kb

input:

511 512
-1 0 0 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 ...

output:

655368480
979089518
133738288
486298234
70832346

result:

ok 7 lines

Test #12:

score: 0
Accepted
time: 4ms
memory: 22168kb

input:

511 512
-1 0 0 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 ...

output:

640949026
225483138
810019272
225483138
640949026

result:

ok 7 lines

Test #13:

score: 0
Accepted
time: 0ms
memory: 22940kb

input:

511 512
-1 0 0 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 ...

output:

655368480
457459326
408972838
872925214
486298234

result:

ok 7 lines

Test #14:

score: 0
Accepted
time: 0ms
memory: 22476kb

input:

726 727
-1 0 0 2 1 1 2 3 5 7 9 4 9 7 6 6 11 8 16 12 17 19 3 14 18 16 15 25 10 10 8 27 26 24 20 30 14 18 33 32 4 40 12 25 30 22 43 45 39 46 13 33 23 13 35 26 31 15 57 47 38 22 37 28 41 55 39 43 23 29 64 17 49 67 24 36 55 5 59 62 63 59 48 28 70 11 71 74 76 56 84 66 88 88 56 58 77 27 79 38 74 98 95 44 ...

output:

706880838
491517432

result:

ok 4 lines

Test #15:

score: 0
Accepted
time: 0ms
memory: 22508kb

input:

999 1000
-1 0 1 1 0 4 2 5 5 8 8 3 7 9 6 4 15 16 7 2 11 13 13 18 21 23 12 10 6 20 29 18 16 19 14 31 24 34 35 17 28 26 27 31 29 25 45 43 33 46 32 23 27 42 48 14 15 42 45 37 12 41 59 43 51 57 3 47 40 38 39 64 66 21 56 19 61 59 58 55 26 11 40 77 63 82 48 85 58 53 56 10 22 75 92 91 92 47 81 52 71 96 100 ...

output:

942041994
438937124
841357772
232099870
90068874

result:

ok 7 lines

Test #16:

score: 0
Accepted
time: 2ms
memory: 22100kb

input:

999 1000
-1 0 1 2 3 0 3 6 5 8 6 8 11 9 1 14 10 12 10 13 2 20 4 17 22 13 12 26 15 11 14 27 31 4 30 19 32 18 32 21 38 36 30 19 17 25 23 25 39 27 48 40 41 41 47 38 46 56 54 56 34 45 20 52 57 58 62 65 65 29 40 43 28 54 5 34 26 15 61 67 49 9 43 46 73 76 68 79 87 83 81 47 82 92 68 52 28 86 69 60 93 71 71 ...

output:

846777934
543886020
117265458
170290282
281705356

result:

ok 7 lines

Test #17:

score: 0
Accepted
time: 2ms
memory: 21316kb

input:

999 1000
-1 0 1 0 1 4 2 5 3 2 5 6 3 9 8 6 7 10 15 14 8 11 18 22 19 12 4 25 22 12 21 7 31 17 15 13 30 27 18 11 38 36 27 42 42 40 37 9 13 20 29 10 49 47 43 34 50 55 19 58 28 17 47 48 35 64 36 64 61 33 37 33 62 16 24 53 67 65 73 70 29 26 54 58 69 51 75 14 82 59 59 77 80 63 46 90 56 30 77 94 39 49 68 66...

output:

705376374
644042668
670552036

result:

ok 5 lines

Test #18:

score: 0
Accepted
time: 0ms
memory: 21312kb

input:

999 1000
-1 0 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:

934163262
112313082
337041484
769464108
426960866

result:

ok 7 lines

Test #19:

score: 0
Accepted
time: 0ms
memory: 22536kb

input:

999 1000
-1 0 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:

824177488
180713918
915259054
915239172
406741568

result:

ok 7 lines

Test #20:

score: 0
Accepted
time: 0ms
memory: 21664kb

input:

848 849
-1 0 0 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 ...

output:

740267208
421935812
842353974
899432906
740267208

result:

ok 7 lines

Subtask #3:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #21:

score: 0
Wrong Answer
time: 4ms
memory: 23044kb

input:

722 938
-1 0 0 0 3 4 0 0 4 2 8 6 6 0 0 12 0 9 12 4 10 18 18 16 6 7 25 6 6 19 27 22 2 11 19 10 14 9 35 16 25 23 25 6 39 14 23 44 36 2 49 11 47 43 32 37 27 23 34 6 43 21 0 32 28 64 12 2 49 49 56 14 70 67 67 27 18 24 75 39 13 53 27 71 77 69 0 32 19 88 66 15 90 71 74 94 28 86 63 80 89 0 69 65 3 104 56 1...

output:

1173419898
-1527357592
567105092
1237330762

result:

wrong answer 3rd lines differ - expected: '759476520', found: '1173419898'

Subtask #4:

score: 4
Accepted

Test #43:

score: 4
Accepted
time: 43ms
memory: 26260kb

input:

32767 32768
-1 0 0 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...

output:

431985922
394586018
431985922
469385826
506785730
469385826
431985922
469385826
431985922
469385826
506785730
469385826
431985922
394586018
357186114
319786210
357186114
394586018
431985922
394586018
357186114
394586018
431985922
469385826
506785730
469385826
431985922
394586018
357186114
319786210
...

result:

ok 71356 lines

Test #44:

score: 0
Accepted
time: 60ms
memory: 28592kb

input:

65535 65536
-1 0 0 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...

output:

913758140
928668562
913758140
898847718
883937296
869026874
883937296
898847718
913758140
928668562
913758140
898847718
883937296
898847718
913758140
928668562
913758140
898847718
913758140
928668562
943578984
928668562
913758140
928668562
913758140
898847718
883937296
869026874
883937296
898847718
...

result:

ok 100002 lines

Test #45:

score: 0
Accepted
time: 63ms
memory: 28788kb

input:

65535 65536
-1 0 0 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...

output:

152530276
137619854
122709432
107799010
92888588
77978166
63067744
48157322
33246900
18336478
3426056
988517656
973607234
958696812
943786390
928875968
913965546
899055124
884144702
869234280
854323858
839413436
824503014
809592592
794682170
779771748
764861326
749950904
735040482
720130060
70521963...

result:

ok 100002 lines

Test #46:

score: 0
Accepted
time: 69ms
memory: 27744kb

input:

65535 65536
-1 0 0 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...

output:

14910422
29820844
44731266
59641688
74552110
89462532
104372954
119283376
134193798
149104220
164014642
178925064
193835486
208745908
223656330
238566752
253477174
268387596
283298018
298208440
313118862
328029284
342939706
357850128
372760550
387670972
402581394
417491816
432402238
447312660
462223...

result:

ok 100002 lines

Subtask #5:

score: 12
Accepted

Dependency #4:

100%
Accepted

Test #47:

score: 12
Accepted
time: 65ms
memory: 24492kb

input:

32767 32768
-1 0 0 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...

output:

105182172
904826008
249436868
17023698
882566410
487194958
692003610
262795534
589599284
280604666
916403034
926198420
674194478
705362276
937775446
700017356
700017356
485413318
981407456
376776886
750775926
498771984
502335264
158609568
953802938
851398612
916403034
392804378
552199380
996206
7765...

result:

ok 80874 lines

Test #48:

score: 0
Accepted
time: 108ms
memory: 30404kb

input:

65535 65536
-1 0 0 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...

output:

987306502
479348406
404796296
600639278
987306502
690101810
599635530
420710466
657269722
880926052
746732254
345154608
59849094
238774158
419706718
237770410
882933548
596624286
852108956
551893020
193039144
641355552
924653570
551893020
87662442
115475790
803362698
86658694
968381088
28020754
3888...

result:

ok 100002 lines

Test #49:

score: 0
Accepted
time: 81ms
memory: 29800kb

input:

65535 65536
-1 0 0 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...

output:

583721360
598631782
568810938
553900516
538990094
538990094
568810938
598631782
538990094
524079672
524079672
613542204
598631782
613542204
628452626
583721360
568810938
583721360
583721360
598631782
628452626
568810938
524079672
643363048
583721360
568810938
568810938
643363048
524079672
583721360
...

result:

ok 100002 lines

Test #50:

score: 0
Accepted
time: 67ms
memory: 30848kb

input:

65535 65536
-1 0 0 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...

output:

106587856
60852842
91677434
105584108
61856590
150315374
17125324
150315374
61856590
60852842
2214902
45942420
91677434
105584108
76767012
75763264
76767012
90673686
76767012
165225796
32035746
150315374
46946168
150315374
136408700
120494530
46946168
75763264
91677434
105584108
46946168
90673686
76...

result:

ok 100002 lines

Test #51:

score: 0
Accepted
time: 21ms
memory: 22512kb

input:

2047 2048
-1 0 0 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 5...

output:

134861748
303006848
798573570
283689758
183944440
847656262
381855142
500917550
807442148
728593854
936953068
441386346
490469038
570897266
262792734
966718670
362538052
996484272
15799340
362538052
45564942
500917550
866973352
600662868
828339172
858104774
907187466
817890660
590214356
303006848
27...

result:

ok 50568 lines

Test #52:

score: 0
Accepted
time: 49ms
memory: 22408kb

input:

4095 4096
-1 0 0 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 5...

output:

603631736
197613152
784946490
375602856
512420184
601415036
507986784
195396452
789379890
650345862
560242660
421208632
283282954
830552266
192071402
325563680
282174604
917330418
237677178
967369594
558025960
466814408
12973348
829443916
604740086
192071402
737124014
284391304
422316982
832768966
7...

result:

ok 100002 lines

Test #53:

score: 0
Accepted
time: 55ms
memory: 22776kb

input:

4095 4096
-1 0 0 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 5...

output:

148682326
148682326
784946490
466814408
148682326
784946490
784946490
148682326
148682326
512420184
739340714
57470774
57470774
57470774
421208632
830552266
148682326
194288102
512420184
830552266
512420184
512420184
239893878
921763818
876158042
558025960
148682326
876158042
194288102
512420184
421...

result:

ok 100002 lines

Test #54:

score: 0
Accepted
time: 31ms
memory: 22524kb

input:

4095 4096
-1 0 0 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 5...

output:

783838140
786054840
101968200
467922758
465706058
740449064
56362424
104184900
101968200
467922758
465706058
104184900
783838140
467922758
147573976
831660616
511311834
786054840
101968200
831660616
465706058
149790676
829443916
831660616
147573976
467922758
465706058
149790676
465706058
149790676
1...

result:

ok 100002 lines

Subtask #6:

score: 27
Accepted

Dependency #2:

100%
Accepted

Test #55:

score: 27
Accepted
time: 121ms
memory: 35008kb

input:

98261 98262
-1 0 0 1 2 2 4 5 3 8 6 6 1 10 13 10 9 5 12 11 18 17 20 4 18 19 24 11 26 27 24 29 17 29 25 34 7 7 13 21 16 9 23 38 33 25 28 21 37 48 40 46 43 38 49 27 41 22 42 39 58 36 56 32 42 61 22 30 36 47 68 67 59 66 58 23 3 52 39 44 12 8 51 26 74 76 81 65 53 19 59 90 20 83 54 90 77 37 70 67 68 48 73...

output:

732332002
281856764
14589944
411925198
494975700
394036962
773421578
775146066
4883078
260203704
903670862
346009340
587339956
274764376
460788066
389167006
366495594
540344200
552587736
827184842
811178920
435730860
31164648
948570022
596481960
285872536
249124126
542862090
457661798
194120298
6299...

result:

ok 95649 lines

Test #56:

score: 0
Accepted
time: 118ms
memory: 33816kb

input:

99999 100000
-1 0 0 2 3 4 3 2 1 8 5 10 7 4 5 9 8 16 9 13 14 1 19 17 14 23 7 18 21 27 12 23 24 16 33 30 17 12 26 33 25 28 34 27 29 15 29 43 6 47 18 50 31 37 41 54 50 30 28 6 38 43 21 60 44 49 42 57 56 61 52 59 54 45 68 64 41 49 73 76 61 78 74 82 63 24 26 67 51 72 66 80 58 78 81 83 74 64 39 69 86 40 1...

output:

72622774
140280672
444113672
653654534
485348608
926360358
561479232
355415686
583042702
802022654
493146084
587106804
366303974
382276586
391742780
559151938
835245020
689548220
574614466
21188546
715435886
518764646
584779752
164185398
894167282
821817624
781841448
817414648
513938644
781147460
10...

result:

ok 100002 lines

Test #57:

score: 0
Accepted
time: 103ms
memory: 34300kb

input:

99999 100000
-1 0 1 2 3 0 4 5 6 7 8 6 9 11 12 14 3 15 1 9 17 16 21 17 4 18 23 24 16 21 28 30 29 25 5 27 2 27 12 37 33 33 36 38 39 43 26 36 19 20 45 50 14 29 51 51 41 20 48 19 40 15 47 34 52 47 42 52 23 57 18 67 35 61 60 69 38 69 75 44 48 70 63 60 64 73 62 86 50 37 25 44 88 76 93 73 90 61 74 85 59 71...

output:

132550234
49841434
420216762
944477446
354015584
145957196
694152308
700008458
126083600
327246656
590848220
497848900
41929052
246281020
763801480
109944748
30115632
84586906
904451102
129806150
264667918
304538036
202591916
262101986
976281864
568757726
725412776
320997330
116863194
338182944
1876...

result:

ok 100002 lines

Test #58:

score: 0
Accepted
time: 78ms
memory: 34164kb

input:

99999 100000
-1 0 0 2 2 3 4 5 6 1 9 1 8 10 11 8 12 7 14 4 15 13 11 20 17 9 24 19 24 5 26 15 23 18 6 23 14 16 25 33 21 21 27 13 39 35 30 22 29 47 19 36 36 48 44 37 52 7 40 50 56 31 40 54 22 44 41 61 25 27 66 49 62 3 32 55 29 53 75 51 54 80 72 28 43 83 38 49 43 86 59 72 89 10 58 51 93 93 69 61 64 16 3...

output:

243156070
974196636
776446796
149211350
640051670
953877066
465384064
642116074
777398194
954130204
523722976
954130204
523722976
584379430
407900558
721376824
978957488
402537438
862279664
895791292
920269446
954130204
666943358
330451074
777049064
156036606
321814552
148006814
29866854
837452380
2...

result:

ok 81651 lines

Test #59:

score: 0
Accepted
time: 113ms
memory: 55868kb

input:

99999 100000
-1 0 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 ...

output:

564528107
714961305
219237221
445787017
493715457
333295075
673119103
58524427
2956429
318864001
295182981
597059449
824990283
940859709
403852445
89124159
779617469
227564407
394490083
785422525
179269047
418286597
476200727
737490423
163562677
273206323
876125757
352080987
260330951
288123723
4114...

result:

ok 100002 lines

Test #60:

score: 0
Accepted
time: 99ms
memory: 54352kb

input:

99999 100000
-1 0 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 ...

output:

721730437
688232759
721730437
17196154
450170436
416672730
516749870
183317034
294534124
259070468
825859032
390918964
825858824
725781892
292568098
592623080
692699957
192491239
525923713
27680880
127757708
94260206
459344390
359267350
259606096
926175434
160064594
317786664
19042202
452255996
2559...

result:

ok 100002 lines

Subtask #7:

score: 0
Skipped

Dependency #3:

0%

Subtask #8:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%