QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#54221#4572. Fancy Stacknot_so_organic#AC ✓258ms3828kbC++233.2kb2022-10-07 16:31:192022-10-07 16:31:20

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-07 16:31:20]
  • 评测
  • 测评结果:AC
  • 用时:258ms
  • 内存:3828kb
  • [2022-10-07 16:31:19]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
//#define int long long 
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

// modint
#define mod 998244353
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	modint &operator +=(int o){return x=x+o>=mod?x+o-mod:x+o,*this;}
	modint &operator -=(int o){return x=x-o<0?x-o+mod:x-o,*this;}
	modint &operator *=(int o){return x=1ll*x*o%mod,*this;}
	modint &operator /=(int o){return *this *= ((modint(o))^=mod-2);}
	template<class I>friend modint operator +(modint a,I b){return a+=b;}
	template<class I>friend modint operator -(modint a,I b){return a-=b;}
	template<class I>friend modint operator *(modint a,I b){return a*=b;}
	template<class I>friend modint operator /(modint a,I b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,int b){return a.x==b;}
	friend bool operator !=(modint a,int b){return a.x!=b;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}

vector<modint> fac,ifac,iv;
inline void initC(int n)
{
	if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
	int m=iv.size(); ++n;
	if(m>=n)return;
	iv.resize(n),fac.resize(n),ifac.resize(n);
	For(i,m,n-1){
		iv[i]=iv[mod%i]*(mod-mod/i);
		fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
	}
}
inline modint C(int n,int m){
	if(m<0||n<m)return 0;
	return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
  
#define maxn 400005
#define inf 0x3f3f3f3f

int n,a[maxn],cnt[maxn];
modint f[5005][2],g[5005][2];

void work()
{
	n=read();
	For(i,1,n)cnt[i]=0,f[i][0]=f[i][1]=g[i][0]=g[i][1]=0;
	int mn=n,mx=0;
	For(i,1,n){
		int x=read();
		++cnt[x],mn=min(mn,x);
		mx=max(mx,x);
	}
	if(cnt[mx]>=2){
		puts("0");
		return;
	}
	--cnt[mx];
	f[0][0]=1;
	Rep(k,n,1){
		if(!cnt[k])continue;
		int c=cnt[k];
		For(i,0,n/2)
			if(f[i][0].x || f[i][1].x){
				if(i>=c){
					g[i-c][0]+=f[i][0]*C(i,c);
					g[i-c][1]+=f[i][1]*C(i,c);
				}
				if(i>=(c-1)){
					g[i-(c-1)][1]+=f[i][0]*C(i,c-1);
					g[i+1-(c-1)][0]+=f[i][0]*C(i,(c-1)); 
				}
			}
		For(i,0,n/2)
			f[i][0]=g[i][0],f[i][1]=g[i][1],g[i][0]=g[i][1]=0;
	//	cout<<"k,c "<<k<<" "<<c <<endl;
	//	For(i,0,n/2)cout<<f[i][0].x<<" "<<f[i][1].x;puts("");
	}
	cout<<f[0][1].x<<endl;
}

signed main()
{
	int T=read();
	while(T--)work();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3664kb

input:

2
4
1 2 3 4
8
1 1 2 3 4 4 6 7

output:

2
4

result:

ok 2 number(s): "2 4"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

637
8
1 1 2 2 6 6 6 7
8
1 1 2 2 4 4 8 8
8
1 1 3 4 4 5 5 5
8
2 2 2 4 4 4 4 8
8
4 4 6 6 6 7 7 7
8
1 2 4 4 7 7 7 7
8
1 3 3 5 5 7 7 8
6
3 5 5 5 5 5
8
1 1 1 2 3 5 6 6
8
1 3 3 3 5 7 8 8
8
2 2 2 2 2 2 7 8
8
1 1 1 1 1 6 7 8
8
1 1 3 6 8 8 8 8
8
5 5 5 6 6 7 7 8
8
4 5 5 5 5 5 5 8
8
3 4 5 5 5 6 6 6
8
1 1 3 3 5 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
1
0
0
1
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
...

result:

ok 637 numbers

Test #3:

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

input:

640
8
2 2 3 4 6 6 8 8
8
1 1 5 5 7 7 7 7
8
3 3 4 5 6 7 7 7
8
1 3 3 4 4 4 6 8
8
2 2 3 3 3 4 5 6
8
1 1 2 6 6 6 6 7
8
3 3 3 5 6 6 6 7
8
2 3 6 6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0
...

result:

ok 636 numbers

Test #8:

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

input:

636
8
2 2 2 4 4 8 8 8
8
3 4 6 7 7 7 8 8
8
2 2 4 4 7 8 8 8
8
1 2 2 5 5 5 5 6
8
1 1 1 1 2 2 3 4
8
1 1 3 3 3 5 5 8
8
1 1 1 3 3 3 4 4
8
2 2 5 6 7 8 8 8
8
3 4 4 5 6 8 8 8
8
1 2 2 3 5 5 5 6
6
3 3 3 4 6 6
8
1 1 6 8 8 8 8 8
8
2 2 2 3 3 3 8 8
8
1 3 4 4 4 5 8 8
8
3 3 5 5 5 5 5 5
8
1 1 2 3 4 5 5 6
8
1 4 4 4 4 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
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
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
1
0
0
0
0
0
0
0
0
0
0
0
0
6
0
0
0
0
0
0
0
7
0
...

result:

ok 636 numbers

Test #9:

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

input:

637
8
1 1 1 2 3 6 7 8
8
3 3 3 3 4 4 8 8
8
1 1 3 5 7 8 8 8
8
2 3 3 4 4 5 5 6
8
1 1 1 3 5 7 8 8
8
2 4 4 7 7 7 8 8
8
2 2 2 2 4 6 7 8
8
1 1 2 3 4 4 7 8
8
1 1 3 5 7 7 7 7
8
1 2 5 6 6 6 6 7
8
1 1 4 7 7 7 7 8
8
1 1 1 2 3 5 5 6
8
1 2 2 3 3 3 6 7
8
3 5 5 5 5 5 6 8
8
4 4 4 4 4 5 7 8
8
3 3 3 3 4 4 7 8
8
1 1 1 ...

output:

7
0
0
0
0
0
1
4
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
0
6
0
0
0
1
0
0
0
0
0
2
0
0
1
0
0
0
0
0
0
0
0
6
2
0
0
0
0
0
0
0
0
0
0
7
2
0
0
0
0
0
0
0
0
0
0
0
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
1
0
0
0
0
0
0
0
0
0
3
0
0
0
0
0
1
0
1
0
0
...

result:

ok 565 numbers

Test #13:

score: 0
Accepted
time: 7ms
memory: 3644kb

input:

2500
2
1 2
2
1 1
2
2 2
2
1 2
2
1 1
2
1 1
2
2 2
2
1 2
2
1 2
2
1 2
2
1 1
2
1 2
2
1 2
2
1 1
2
1 2
2
1 2
2
1 2
2
1 2
2
1 1
2
2 2
2
2 2
2
1 2
2
1 2
2
2 2
2
1 2
2
1 2
2
2 2
2
1 2
2
1 2
2
1 1
2
1 2
2
1 1
2
1 2
2
1 2
2
2 2
2
1 2
2
1 2
2
1 1
2
2 2
2
1 2
2
2 2
2
1 1
2
1 2
2
2 2
2
2 2
2
1 2
2
1 1
2
2 2
2
2 2
2...

output:

1
0
0
1
0
0
0
1
1
1
0
1
1
0
1
1
1
1
0
0
0
1
1
0
1
1
0
1
1
0
1
0
1
1
0
1
1
0
0
1
0
0
1
0
0
1
0
0
0
0
1
1
0
1
1
1
0
0
1
0
1
0
1
0
1
1
0
0
1
0
1
1
1
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
1
0
0
0
1
0
1
0
0
1
1
0
1
1
1
1
1
1
0
1
0
0
0
0
1
0
0
1
0
0
1
1
0
1
0
1
1
1
1
0
0
1
1
1
0
1
0
0
1
0
0
0
1
0
1
0
0
0
1
0
0
0
...

result:

ok 2500 numbers

Test #14:

score: 0
Accepted
time: 16ms
memory: 3644kb

input:

1250
6
1 2 2 3 3 4
4
1 3 3 3
4
1 2 3 4
4
1 3 4 4
2
2 2
2
1 2
4
1 1 1 4
2
1 1
6
2 5 5 5 5 6
10
2 2 5 5 6 6 7 9 10 10
4
2 2 3 3
2
2 2
2
2 2
6
1 1 5 6 6 6
2
1 2
4
1 1 2 3
2
1 2
14
3 5 5 5 8 9 9 10 10 11 12 13 14 14
2
2 2
2
2 2
2
1 1
4
1 1 2 4
2
1 2
6
1 3 3 5 5 5
2
1 1
2
2 2
4
1 3 3 3
2
2 2
2
2 2
4
1 2 ...

output:

0
0
2
0
0
1
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
1
1
0
0
0
0
0
0
2
0
1
1
0
0
1
1
0
1
0
1
1
1
0
0
0
0
1
0
1
0
1
0
0
0
0
1
0
1
0
0
0
1
1
1
0
0
1
0
0
1
1
0
0
0
1
2
0
0
1
0
2
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
0
1
1
1
0
0
0
1
1
0
0
1
0
0
0
1
1
0
0
2
0
0
1
0
0
1
0
0
0
0
0
1
1
1
0
0
1
0
0
0
0
1
1
0
1
0
0
1
0
1
1
1
0
...

result:

ok 1250 numbers

Test #15:

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

input:

625
2
1 1
12
1 2 4 4 5 6 7 9 10 11 11 12
20
3 5 6 7 8 8 9 10 10 11 12 12 12 12 13 14 16 16 16 16
2
1 2
8
1 2 2 4 6 6 6 8
12
2 2 3 4 5 5 7 7 7 7 7 9
4
1 2 3 3
2
2 2
6
1 2 2 4 5 6
28
1 1 1 1 2 2 3 5 5 5 6 7 8 10 11 11 13 14 15 17 17 18 20 20 23 23 24 28
10
1 3 4 5 5 7 8 9 9 9
28
1 1 2 3 4 5 5 5 6 6 7 ...

output:

0
0
0
1
0
0
0
0
3
2269485
0
4479936
0
1
0
0
1
0
1
0
6
0
0
1
0
0
0
3
0
1
0
0
0
1
0
0
1
0
0
0
1
1
0
6
0
0
0
4
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
48
0
1
0
4
0
0
0
1
0
1
0
2
1
0
0
0
1
64575
0
0
0
0
1
0
1
0
1
0
0
1
0
0
0
2
0
2
0
4
0
0
0
1
0
1
1
0
0
0
0
2
0
155808
0
0
0
0
643872
0...

result:

ok 625 numbers

Test #16:

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

input:

312
12
1 2 2 2 5 7 8 8 9 9 10 11
24
1 1 2 3 4 7 7 7 8 10 10 11 11 12 13 15 17 17 19 19 20 22 22 23
6
2 2 4 4 5 5
14
1 1 2 3 4 5 6 6 8 9 9 10 13 13
42
2 2 3 3 4 6 6 7 7 9 10 11 11 12 12 13 13 13 16 17 17 19 20 20 21 22 24 25 26 26 29 29 30 30 31 32 33 37 39 40 40 41
28
1 2 2 4 6 6 6 9 10 11 11 15 15 ...

output:

4
0
0
0
0
0
0
0
153
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
2
1
0
235298040
0
2
0
0
10176
0
104768
0
0
0
0
0
23328
0
0
0
0
0
18
0
0
0
0
1
0
1
292182124
0
0
0
0
1
0
0
0
0
0
0
0
1584
416220
0
1
44
0
3
198740177
0
0
0
0
0
3
1
0
0
0
0
0
1
0
8020
0
1030
0
0
0
0
220
0
0
0
0
135506938
0
1
1
0
0
0
0
0
0
0
0
0
0
0
7...

result:

ok 312 numbers

Test #17:

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

input:

156
12
1 1 3 3 3 5 5 6 9 9 12 12
6
2 2 2 3 5 5
6
1 2 2 2 2 5
6
1 3 3 4 5 6
72
1 1 1 1 3 3 3 5 9 11 13 14 15 15 17 19 20 22 22 22 22 22 25 26 27 28 28 30 30 30 32 32 32 34 34 35 35 36 36 37 39 39 41 42 43 46 46 46 47 47 48 48 48 48 50 50 50 51 52 53 56 60 61 62 64 64 68 69 70 71 71 72
20
1 1 1 2 3 4 ...

output:

0
0
0
3
0
0
3
0
0
0
0
0
0
0
0
47
0
0
0
0
0
0
0
0
11520
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
351927837
0
0
0
0
0
0
0
0
18
0
0
0
0
0
0
0
0
0
0
944866533
0
0
82151280
960297605
0
138
0
0
0
0
0
0
0
0
0
160758022
0
0
0
0
0
2
0
0
0
0
23972670
0
0
0
0
12672
0
3207750
0
0
0
5820
0
105313607
0
0
131484131
0
1
0...

result:

ok 156 numbers

Test #18:

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

input:

78
74
4 5 5 7 7 9 9 11 11 12 13 14 14 14 15 15 17 17 20 20 21 22 23 24 25 25 25 27 28 28 34 34 37 37 38 40 40 40 41 42 44 44 45 46 46 46 47 47 48 50 51 51 51 51 52 52 53 55 55 55 56 58 60 61 62 62 63 63 66 70 70 70 73 74
38
4 5 6 6 8 10 10 10 10 10 11 12 12 13 13 14 16 16 17 18 19 19 20 20 20 20 21 ...

output:

0
0
880821061
69
0
0
110993407
0
297573582
0
0
0
0
0
195857036
0
0
0
0
0
0
0
1
0
0
0
0
0
0
35460
0
0
0
0
0
0
0
0
0
0
668141080
0
0
673760204
0
0
0
0
0
0
0
631525568
0
661854035
0
0
0
0
0
0
0
1
0
0
0
0
0
0
72
0
0
4
0
599031230
0
0
0
0

result:

ok 78 numbers

Test #19:

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

input:

39
308
1 1 2 3 4 5 5 5 6 7 8 9 10 10 11 13 13 13 14 14 15 17 18 22 23 23 24 24 24 25 25 26 26 26 26 28 29 30 30 31 32 34 34 34 35 36 37 39 39 39 39 40 40 40 41 42 43 43 45 46 47 48 48 48 49 49 49 51 52 52 53 54 56 57 58 58 60 60 60 63 63 64 64 65 65 66 67 67 67 70 71 72 72 75 75 76 76 78 80 80 81 82...

output:

0
0
0
0
0
902867214
0
0
0
0
0
0
0
0
0
0
12386403
0
583165706
302853101
0
0
0
0
0
532909061
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 39 numbers

Test #20:

score: 0
Accepted
time: 5ms
memory: 3648kb

input:

19
210
1 1 1 1 2 2 3 4 4 7 8 10 11 12 14 14 15 16 17 17 18 18 21 23 24 26 27 27 27 28 28 29 33 34 34 35 36 37 37 39 40 41 41 42 43 44 46 47 47 49 50 50 51 51 51 51 51 51 52 52 53 53 54 55 55 57 58 62 62 63 64 64 64 65 69 70 71 72 73 74 75 76 77 79 81 81 84 84 84 85 89 90 90 93 94 95 96 97 97 98 99 1...

output:

0
844337543
952448091
10624
0
0
667304506
0
0
0
0
685043478
0
0
0
451527246
0
0
0

result:

ok 19 numbers

Test #21:

score: 0
Accepted
time: 10ms
memory: 3556kb

input:

9
198
1 1 3 4 5 6 6 6 6 8 8 8 8 9 10 10 11 13 13 14 14 16 20 20 20 22 23 27 27 28 29 29 30 30 32 34 37 39 42 43 44 46 47 48 50 51 52 52 53 53 55 56 58 58 59 60 62 65 65 66 67 68 69 69 70 71 72 73 74 76 78 79 80 81 82 84 84 84 84 85 85 86 88 89 91 91 93 93 94 95 95 96 98 99 100 101 104 104 107 107 10...

output:

0
626956723
868794046
0
0
0
982140127
0
0

result:

ok 9 numbers

Test #22:

score: 0
Accepted
time: 41ms
memory: 3764kb

input:

4
522
1 1 1 2 3 3 4 5 6 7 8 10 10 11 12 13 13 13 14 14 15 16 16 17 18 18 19 22 22 24 24 25 26 27 29 29 31 31 33 35 36 37 38 40 40 40 41 42 43 47 47 47 49 50 51 52 52 54 55 55 58 64 64 69 71 73 74 74 75 76 76 76 76 76 76 77 77 77 80 81 81 82 83 84 85 86 87 91 93 94 94 94 96 96 98 99 100 100 100 102 1...

output:

0
146843102
637519709
0

result:

ok 4 number(s): "0 146843102 637519709 0"

Test #23:

score: 0
Accepted
time: 15ms
memory: 3664kb

input:

2
3540
3 3 3 3 12 12 15 16 19 19 19 20 20 20 21 22 23 23 25 29 29 31 33 34 37 41 42 42 43 43 44 46 48 49 49 52 52 54 54 57 57 57 59 61 61 62 63 66 66 66 67 67 67 68 68 68 70 71 71 72 72 73 73 73 74 78 82 83 85 87 87 87 87 89 93 94 94 94 95 97 98 98 100 100 101 102 103 105 105 105 106 112 112 112 116...

output:

0
0

result:

ok 2 number(s): "0 0"

Test #24:

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

input:

1
5000
1 2 3 3 8 9 11 11 13 14 15 15 16 19 19 20 21 21 22 22 22 22 23 23 24 25 27 28 28 29 29 33 34 34 36 38 38 40 41 42 43 44 46 47 49 49 50 51 52 53 55 56 57 59 59 59 60 62 63 64 64 64 64 67 67 67 68 70 71 73 73 74 76 76 76 76 77 78 79 79 80 82 83 84 85 86 86 86 89 90 91 92 93 96 96 97 98 98 99 99...

output:

0

result:

ok 1 number(s): "0"

Test #25:

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

input:

1
5000
2 3 6 7 8 8 9 9 10 10 15 15 17 17 18 19 20 20 21 21 21 22 24 26 27 27 29 32 32 32 35 35 35 37 38 40 40 43 46 46 47 50 50 50 50 52 53 54 55 56 57 57 58 58 59 60 60 61 61 61 62 62 62 63 64 64 65 66 66 66 67 68 69 69 71 72 73 73 75 77 79 80 80 81 82 83 83 83 85 86 89 90 93 94 96 98 100 100 102 1...

output:

0

result:

ok 1 number(s): "0"

Test #26:

score: 0
Accepted
time: 90ms
memory: 3720kb

input:

1
5000
1 2 5 5 5 6 6 8 8 9 9 10 10 10 12 12 13 13 13 16 16 17 17 18 22 22 22 24 26 27 27 27 29 31 32 33 34 34 36 36 38 40 40 41 43 44 45 45 46 46 46 48 50 50 51 52 53 55 58 59 63 63 64 64 66 66 67 67 68 70 70 72 73 75 77 77 77 77 78 78 78 78 79 79 79 79 80 82 82 82 83 85 87 88 89 89 89 89 90 92 93 9...

output:

984262466

result:

ok 1 number(s): "984262466"

Test #27:

score: 0
Accepted
time: 25ms
memory: 3684kb

input:

1
5000
1 2 2 3 4 5 5 6 6 7 8 11 11 12 14 15 15 18 18 22 23 23 23 24 25 25 26 27 27 27 28 28 31 31 32 33 36 36 37 37 38 39 40 43 45 46 48 49 52 52 55 56 56 56 56 58 60 60 62 62 64 64 65 65 66 67 67 69 70 70 70 70 71 73 73 75 75 76 77 80 81 81 85 86 86 87 89 90 90 91 91 93 94 94 94 95 95 95 97 98 98 9...

output:

0

result:

ok 1 number(s): "0"

Test #28:

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

input:

1
5000
1 1 2 4 5 6 7 7 8 9 9 11 11 12 12 12 13 14 14 15 15 15 17 18 18 19 20 20 21 21 22 22 23 24 25 27 28 28 28 30 30 30 31 36 37 37 38 39 39 41 42 44 44 45 46 46 47 47 49 51 51 52 52 53 53 55 55 55 58 61 62 63 64 65 65 65 67 67 69 70 71 72 73 73 74 74 74 74 74 75 77 82 82 83 85 86 87 87 88 88 91 9...

output:

134597280

result:

ok 1 number(s): "134597280"

Test #29:

score: 0
Accepted
time: 26ms
memory: 3648kb

input:

1
5000
1 4 6 7 7 9 10 10 14 15 15 15 16 17 18 18 20 22 26 28 29 30 31 32 32 33 37 40 41 42 43 44 45 46 47 48 50 51 52 53 54 60 61 62 64 67 68 69 69 70 72 74 74 75 76 76 77 77 78 78 79 79 81 84 85 86 88 90 90 91 93 94 94 97 100 101 101 102 103 104 104 105 105 105 106 107 107 108 108 111 113 113 114 1...

output:

0

result:

ok 1 number(s): "0"

Test #30:

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

input:

1
5000
1 2 2 2 3 3 4 5 6 7 7 8 9 9 10 10 11 11 12 14 14 16 17 18 19 20 20 21 21 22 23 23 23 24 24 24 25 25 29 30 30 30 31 34 35 35 38 39 39 40 43 49 49 49 51 52 52 54 55 58 61 62 64 66 67 68 70 70 74 74 75 75 75 76 76 76 77 78 80 83 83 84 85 85 86 86 86 87 87 87 87 88 88 89 91 93 93 94 94 96 98 99 1...

output:

0

result:

ok 1 number(s): "0"

Test #31:

score: 0
Accepted
time: 74ms
memory: 3712kb

input:

1
5000
1 1 4 5 6 10 10 11 11 13 14 14 14 15 16 16 16 17 21 24 24 25 25 27 28 28 29 30 30 31 32 34 37 38 39 40 40 41 42 43 44 44 44 45 46 46 47 49 49 49 49 50 52 53 55 55 56 56 56 57 57 57 58 58 59 60 62 63 64 64 64 66 66 68 69 69 70 70 71 71 71 73 73 75 76 76 78 78 78 81 82 83 83 83 86 86 86 86 87 8...

output:

463393649

result:

ok 1 number(s): "463393649"

Test #32:

score: 0
Accepted
time: 77ms
memory: 3708kb

input:

1
5000
1 4 6 8 8 8 12 16 17 17 18 21 22 22 23 25 27 28 28 29 29 31 32 32 33 34 36 36 39 40 43 44 46 47 50 51 52 52 53 55 56 57 57 58 60 61 61 61 63 67 67 72 73 74 75 75 79 80 80 81 82 83 83 84 85 86 87 87 88 88 89 89 89 90 90 90 91 93 94 95 96 96 97 98 99 99 99 99 99 100 101 102 102 103 105 106 106 ...

output:

617623612

result:

ok 1 number(s): "617623612"

Test #33:

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

input:

1
5000
3 3 4 4 5 7 9 9 10 10 10 10 10 12 12 13 14 16 17 19 20 21 22 23 25 26 27 28 28 30 30 31 31 32 33 35 37 37 37 38 39 39 43 44 45 46 48 49 51 51 52 54 56 57 57 58 60 60 61 61 63 63 64 65 65 66 70 71 73 73 74 76 78 79 80 83 83 84 84 86 87 87 88 92 92 92 93 93 93 93 94 95 95 95 98 98 98 99 99 99 1...

output:

0

result:

ok 1 number(s): "0"

Test #34:

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

input:

1
5000
1 1 1 2 2 3 4 5 5 7 7 8 10 10 10 10 10 11 13 13 15 15 15 16 17 17 18 19 19 20 21 23 24 24 25 25 28 31 32 32 33 35 35 36 38 38 38 39 39 40 41 41 41 42 44 46 46 47 47 48 49 51 51 54 54 56 56 56 57 59 59 59 60 62 63 63 63 64 65 65 69 69 70 72 73 73 74 74 75 76 76 77 78 78 78 80 80 80 81 83 84 87...

output:

0

result:

ok 1 number(s): "0"

Test #35:

score: 0
Accepted
time: 77ms
memory: 3720kb

input:

1
5000
1 1 3 3 4 4 6 8 9 11 11 11 12 12 13 13 14 15 15 18 20 21 21 21 21 22 23 24 24 24 24 25 27 27 27 28 29 29 31 31 31 32 35 35 36 36 37 41 41 41 41 42 42 42 43 44 44 46 47 48 49 50 51 51 53 55 55 55 56 56 57 57 57 57 60 61 62 63 64 66 66 68 68 69 69 69 70 71 71 72 74 74 74 78 79 80 81 81 83 84 85...

output:

737848027

result:

ok 1 number(s): "737848027"

Test #36:

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

input:

1
5000
2 3 3 3 5 5 6 6 8 9 10 11 12 12 13 16 16 17 18 20 22 22 23 24 24 25 25 27 31 33 33 35 35 35 36 36 36 36 37 38 39 40 42 43 44 45 47 48 48 50 52 52 54 54 55 55 56 56 57 62 62 62 63 63 63 64 67 67 68 68 68 72 72 73 73 75 77 78 78 79 81 81 81 82 83 83 85 87 87 89 89 90 90 91 91 93 93 94 95 95 96 ...

output:

0

result:

ok 1 number(s): "0"

Test #37:

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

input:

1
5000
1 2 4 5 5 6 7 7 9 10 11 12 13 13 13 14 14 15 15 15 17 18 18 19 19 21 21 21 22 23 25 25 26 27 29 30 30 30 31 31 32 32 33 33 34 37 37 38 38 38 40 41 42 42 42 44 45 46 47 47 48 49 49 52 53 53 53 54 55 58 59 60 60 62 63 63 63 64 64 67 68 68 70 71 71 72 72 73 73 74 74 74 75 76 79 81 81 82 83 83 83...

output:

0

result:

ok 1 number(s): "0"

Test #38:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

1
5000
1 1 1 1 1 2 4 4 7 7 8 8 9 9 11 11 12 13 13 13 16 16 17 18 18 18 19 20 21 22 23 23 23 24 25 27 27 27 28 28 29 32 33 33 33 34 37 37 38 39 42 42 43 45 47 48 48 48 50 51 51 53 54 56 56 57 58 59 60 62 64 64 68 68 70 71 72 72 73 74 76 76 77 78 78 78 79 81 85 86 89 90 91 92 93 93 94 95 95 96 97 98 1...

output:

0

result:

ok 1 number(s): "0"

Test #39:

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

input:

1
5000
1 1 2 3 3 4 4 5 7 7 9 10 10 11 11 14 15 16 16 19 21 21 22 22 23 24 24 26 27 28 28 28 29 29 33 34 38 39 39 42 42 42 45 47 47 47 48 48 48 49 51 51 51 52 54 54 54 55 57 57 57 58 59 60 62 62 65 65 66 68 69 71 72 73 75 77 77 77 78 78 79 79 83 84 85 87 88 90 90 90 92 92 93 95 97 98 100 100 101 102 ...

output:

129316206

result:

ok 1 number(s): "129316206"

Test #40:

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

input:

1
5000
1 2 4 4 4 6 9 10 11 11 12 13 14 15 15 15 16 17 19 19 20 20 21 21 23 23 23 24 26 27 27 28 29 29 29 32 33 33 34 36 37 38 39 41 42 44 44 45 46 46 47 49 50 51 51 52 52 53 53 55 57 57 58 60 61 63 64 64 64 65 66 67 67 68 70 72 73 74 74 75 77 77 78 79 80 81 81 83 83 84 85 85 86 87 87 89 90 92 93 93 ...

output:

0

result:

ok 1 number(s): "0"

Test #41:

score: 0
Accepted
time: 75ms
memory: 3724kb

input:

1
5000
6 7 9 12 12 13 13 14 15 15 17 18 19 21 22 23 24 25 26 27 27 28 28 29 29 29 30 30 32 33 33 33 34 35 36 36 37 38 38 40 40 41 41 43 44 46 46 47 48 49 50 51 54 57 61 61 61 63 63 66 66 66 66 67 67 69 69 71 73 73 75 79 83 83 84 85 86 86 87 88 88 89 89 90 92 92 96 96 97 97 97 98 100 102 103 105 106 ...

output:

710231295

result:

ok 1 number(s): "710231295"

Test #42:

score: 0
Accepted
time: 22ms
memory: 3632kb

input:

1
5000
2 2 5 5 6 8 9 9 9 11 12 12 16 19 20 20 21 21 25 26 26 27 27 30 32 34 35 36 37 37 38 38 39 39 40 40 42 42 43 44 47 48 49 50 50 55 56 62 63 64 65 66 67 70 70 70 71 73 74 74 76 78 78 79 80 80 81 81 83 83 83 84 84 85 85 88 90 91 91 91 97 97 99 100 100 101 102 102 103 104 107 107 107 109 110 111 1...

output:

0

result:

ok 1 number(s): "0"

Test #43:

score: 0
Accepted
time: 26ms
memory: 3788kb

input:

1
5000
2 3 5 7 8 8 10 11 15 15 15 16 16 20 20 21 23 24 26 27 27 29 30 30 31 32 32 34 35 36 37 39 40 41 42 45 45 47 47 49 49 50 51 51 54 56 57 59 60 60 60 61 62 63 64 65 66 67 67 68 68 71 73 73 74 74 79 85 86 86 87 87 87 88 88 89 90 91 91 92 94 94 95 96 96 96 96 97 98 99 100 101 102 104 104 105 107 1...

output:

0

result:

ok 1 number(s): "0"

Test #44:

score: 0
Accepted
time: 27ms
memory: 3612kb

input:

1
5000
1 2 4 5 6 7 10 11 12 13 14 15 15 18 20 21 21 22 24 25 25 25 28 29 29 29 32 32 32 32 33 34 34 35 35 35 38 38 38 38 39 40 41 42 42 42 43 43 44 45 47 47 50 50 51 52 52 54 54 57 59 61 63 64 64 64 64 65 67 70 70 70 70 70 72 72 72 72 73 73 75 76 77 78 79 79 79 82 83 87 88 88 89 92 93 96 97 99 99 10...

output:

0

result:

ok 1 number(s): "0"

Test #45:

score: 0
Accepted
time: 258ms
memory: 3752kb

input:

1
5000
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 1...

output:

917698352

result:

ok 1 number(s): "917698352"

Test #46:

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

input:

1
5000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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

result:

ok 1 number(s): "0"

Test #47:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

1
5000
5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 500...

output:

0

result:

ok 1 number(s): "0"

Test #48:

score: 0
Accepted
time: 91ms
memory: 3680kb

input:

1
5000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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

result:

ok 1 number(s): "1"

Test #49:

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

input:

1
5000
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 1...

output:

0

result:

ok 1 number(s): "0"

Test #50:

score: 0
Accepted
time: 17ms
memory: 3684kb

input:

1
5000
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 51 52 52...

output:

1

result:

ok 1 number(s): "1"