QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#616351#9443. Left Equals Rightucup-team159#AC ✓101ms7268kbC++236.6kb2024-10-06 02:22:472024-10-06 02:22:48

Judging History

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

  • [2024-10-06 02:22:48]
  • 评测
  • 测评结果:AC
  • 用时:101ms
  • 内存:7268kb
  • [2024-10-06 02:22:47]
  • 提交

answer

#line 1 "I.cpp"
// #pragma GCC target("avx2,avx512f,avx512vl,avx512bw,avx512dq,avx512cd,avx512vbmi,avx512vbmi2,avx512vpopcntdq,avx512bitalg,bmi,bmi2,lzcnt,popcnt")
// #pragma GCC optimize("Ofast")

#line 2 "/home/sigma/comp/library/template.hpp"

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
using ull = unsigned long long;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb push_back
#define eb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> bool chmax(T& x, U y){
	if(x<y){ x=y; return true; }
	return false;
}
template<class T,class U> bool chmin(T& x, U y){
	if(y<x){ x=y; return true; }
	return false;
}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class T> int lwb(const V<T>& v, const T& a){return lower_bound(all(v),a) - v.begin();}
template<class T>
V<T> Vec(size_t a) {
    return V<T>(a);
}
template<class T, class... Ts>
auto Vec(size_t a, Ts... ts) {
  return V<decltype(Vec<T>(ts...))>(a, Vec<T>(ts...));
}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ~ ";
	dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ";dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif

template<class D> D divFloor(D a, D b){
	return a / b - (((a ^ b) < 0 && a % b != 0) ? 1 : 0);
}
template<class D> D divCeil(D a, D b) {
	return a / b + (((a ^ b) > 0 && a % b != 0) ? 1 : 0);
}
#line 1 "/home/sigma/comp/library/math/mint.cpp"
/*
	任意mod なら 
	template なくして costexpr の行消して global に unsigned int mod = 1;
	で cin>>mod してから使う
	任意 mod はかなり遅いので、できれば "atcoder/modint" を使う
*/

template<unsigned int mod_>
struct ModInt{	
	using uint = unsigned int;
	using ll = long long;
	using ull = unsigned long long;

	constexpr static uint mod = mod_;

	uint v;
	ModInt():v(0){}
	ModInt(ll _v):v(normS(_v%mod+mod)){}
	explicit operator bool() const {return v!=0;}
	static uint normS(const uint &x){return (x<mod)?x:x-mod;}		// [0 , 2*mod-1] -> [0 , mod-1]
	static ModInt make(const uint &x){ModInt m; m.v=x; return m;}
	ModInt operator+(const ModInt& b) const { return make(normS(v+b.v));}
	ModInt operator-(const ModInt& b) const { return make(normS(v+mod-b.v));}
	ModInt operator-() const { return make(normS(mod-v)); }
	ModInt operator*(const ModInt& b) const { return make((ull)v*b.v%mod);}
	ModInt operator/(const ModInt& b) const { return *this*b.inv();}
	ModInt& operator+=(const ModInt& b){ return *this=*this+b;}
	ModInt& operator-=(const ModInt& b){ return *this=*this-b;}
	ModInt& operator*=(const ModInt& b){ return *this=*this*b;}
	ModInt& operator/=(const ModInt& b){ return *this=*this/b;}
	ModInt& operator++(int){ return *this=*this+1;}
	ModInt& operator--(int){ return *this=*this-1;}
	template<class T> friend ModInt operator+(T a, const ModInt& b){ return (ModInt(a) += b);}
	template<class T> friend ModInt operator-(T a, const ModInt& b){ return (ModInt(a) -= b);}
	template<class T> friend ModInt operator*(T a, const ModInt& b){ return (ModInt(a) *= b);}
	template<class T> friend ModInt operator/(T a, const ModInt& b){ return (ModInt(a) /= b);}
	ModInt pow(ll p) const {
		if(p<0) return inv().pow(-p);
		ModInt a = 1;
		ModInt x = *this;
		while(p){
			if(p&1) a *= x;
			x *= x;
			p >>= 1;
		}
		return a;
	}
	ModInt inv() const {		// should be prime
		return pow(mod-2);
	}
	// ll extgcd(ll a,ll b,ll &x,ll &y) const{
	// 	ll p[]={a,1,0},q[]={b,0,1};
	// 	while(*q){
	// 		ll t=*p/ *q;
	// 		rep(i,3) swap(p[i]-=t*q[i],q[i]);
	// 	}
	// 	if(p[0]<0) rep(i,3) p[i]=-p[i];
	// 	x=p[1],y=p[2];
	// 	return p[0];
	// }
	// ModInt inv() const {
	// 	ll x,y;
	// 	extgcd(v,mod,x,y);
	// 	return make(normS(x+mod));
	// }

	bool operator==(const ModInt& b) const { return v==b.v;}
	bool operator!=(const ModInt& b) const { return v!=b.v;}
	bool operator<(const ModInt& b) const { return v<b.v;}
	friend istream& operator>>(istream &o,ModInt& x){
		ll tmp;
		o>>tmp;
		x=ModInt(tmp);
		return o;
	}
	friend ostream& operator<<(ostream &o,const ModInt& x){ return o<<x.v;}
	// friend ostream& operator<<(ostream &o,const ModInt& x){
	// 	for(int b=1;b<=1000;b++){
	// 		ModInt ib = ModInt(b).inv();
	// 		for(int a=-1000;a<=1000;a++){
	// 			if(ModInt(a) * ib == x){
	// 				return o << a << "/" << b;
	// 			}
	// 		}
	// 	}
	// 	return o<<x.v;
	// }
};
using mint = ModInt<998244353>;
//using mint = ModInt<1000000007>;

V<mint> fact,ifact,invs;
// a,b >= 0 のみ
mint Choose(int a,int b){
	if(b<0 || a<b) return 0;
	return fact[a] * ifact[b] * ifact[a-b];
}

/*
// b >= 0 の範囲で、 Choose(a,b) = a(a-1)..(a-b+1) / b!
mint Choose(int a,int b){
	if(b<0 || a<b) return 0;
	return fact[a] * ifact[b] * ifact[a-b];
}
*/

void InitFact(int N){	//[0,N]
	N++;
	fact.resize(N);
	ifact.resize(N);
	invs.resize(N);
	fact[0] = 1;
	rep1(i,N-1) fact[i] = fact[i-1] * i;
	ifact[N-1] = fact[N-1].inv();
	for(int i=N-2;i>=0;i--) ifact[i] = ifact[i+1] * (i+1);
	rep1(i,N-1) invs[i] = fact[i-1] * ifact[i];
}
#line 6 "I.cpp"

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	InitFact(10000);

	int N; cin >> N;
	V<int> A(N); rep(i,N) cin >> A[i];
	int S = accumulate(all(A),0);
	if(S%2){
		cout << 0 << endl;
		return 0;
	}
	VV<mint> dp(N+1, V<mint>(S+1)); dp[0][0] = 1;
	rep(i,N){
		per(j,N) rep(k,S+1){
			if(k+A[i] <= S) dp[j+1][k+A[i]] += dp[j][k];
		}
	}
	mint ans = 0;
	rep(i,N+1) if(dp[i][S/2]){
		ans += dp[i][S/2] * fact[i] * fact[N-i];
	}
	cout << ans << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3680kb

input:

3
4 9 5

output:

4

result:

ok "4"

Test #2:

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

input:

2
100 100

output:

2

result:

ok "2"

Test #3:

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

input:

8
3 2 6 3 1 2 4 5

output:

11520

result:

ok "11520"

Test #4:

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

input:

2
93 93

output:

2

result:

ok "2"

Test #5:

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

input:

2
62 45

output:

0

result:

ok "0"

Test #6:

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

input:

3
32 68 36

output:

4

result:

ok "4"

Test #7:

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

input:

3
27 2 25

output:

4

result:

ok "4"

Test #8:

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

input:

10
38 27 36 88 77 25 73 44 11 21

output:

126720

result:

ok "126720"

Test #9:

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

input:

10
93 78 29 81 14 20 18 71 85 48

output:

0

result:

ok "0"

Test #10:

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

input:

9
57 19 88 13 55 43 27 10 74

output:

5760

result:

ok "5760"

Test #11:

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

input:

10
80 1 44 85 32 85 3 4 80 45

output:

0

result:

ok "0"

Test #12:

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

input:

10
56 72 93 39 70 78 3 10 84 48

output:

0

result:

ok "0"

Test #13:

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

input:

10
2 58 36 81 100 85 11 39 24 50

output:

118080

result:

ok "118080"

Test #14:

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

input:

10
70 23 3 26 98 18 63 32 22 25

output:

158400

result:

ok "158400"

Test #15:

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

input:

10
42 92 12 71 85 68 78 89 98 30

output:

0

result:

ok "0"

Test #16:

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

input:

10
26 5 25 35 77 46 81 13 73 32

output:

0

result:

ok "0"

Test #17:

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

input:

10
37 43 7 51 89 86 84 26 28 15

output:

103680

result:

ok "103680"

Test #18:

score: 0
Accepted
time: 12ms
memory: 3848kb

input:

58
84 96 24 20 3 10 27 57 98 49 32 52 67 18 100 6 100 4 4 88 24 77 75 95 18 83 58 75 71 99 18 53 68 65 76 37 51 19 65 63 28 59 84 59 80 73 83 41 96 30 96 5 13 56 92 84 30 72

output:

670239800

result:

ok "670239800"

Test #19:

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

input:

46
56 33 63 4 25 2 42 41 58 22 98 76 53 94 52 69 40 1 56 43 41 56 40 65 81 91 89 68 36 78 38 14 84 77 28 27 76 8 62 54 15 11 15 52 68 87

output:

0

result:

ok "0"

Test #20:

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

input:

55
55 49 60 49 90 95 61 61 9 5 81 63 6 70 52 64 14 87 18 87 35 19 97 20 70 11 73 48 69 19 55 23 3 73 34 68 45 30 66 37 97 75 71 8 42 91 15 63 86 63 92 48 11 53 3

output:

0

result:

ok "0"

Test #21:

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

input:

44
10 24 66 44 89 40 47 89 87 62 30 32 95 65 81 52 10 66 25 81 19 21 35 18 49 84 60 18 87 69 19 31 38 29 53 60 73 49 71 95 48 13 48 99

output:

0

result:

ok "0"

Test #22:

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

input:

61
39 96 26 73 57 39 47 84 15 54 33 83 52 37 66 66 99 21 29 17 51 74 38 43 71 83 41 86 38 96 12 55 77 70 47 76 28 78 15 40 41 4 12 62 91 5 50 87 71 42 15 67 91 88 54 31 67 90 2 15 50

output:

0

result:

ok "0"

Test #23:

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

input:

69
32 71 20 89 72 81 99 62 46 44 96 33 84 99 16 32 14 10 52 46 3 9 9 41 84 50 14 56 12 15 79 68 72 90 53 54 96 3 100 58 12 74 93 14 8 28 76 86 19 87 92 23 86 93 5 22 15 87 72 92 2 74 58 2 89 43 11 58 11

output:

297754781

result:

ok "297754781"

Test #24:

score: 0
Accepted
time: 8ms
memory: 3772kb

input:

54
50 84 44 63 83 28 48 97 13 75 41 70 2 6 35 95 6 61 77 93 56 84 32 5 83 51 82 71 39 35 38 96 48 35 89 52 49 4 5 50 55 53 86 92 3 17 9 76 9 54 1 67 74 21

output:

715843927

result:

ok "715843927"

Test #25:

score: 0
Accepted
time: 12ms
memory: 3812kb

input:

60
14 27 76 29 43 86 85 61 58 38 59 66 63 99 43 43 38 63 25 82 54 58 39 13 43 81 27 90 51 67 23 56 46 26 11 90 57 39 1 5 97 14 54 78 77 25 77 94 15 56 30 44 71 32 88 2 94 16 23 40

output:

959316858

result:

ok "959316858"

Test #26:

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

input:

56
62 53 6 12 17 99 84 81 68 95 67 68 9 38 11 9 68 100 6 57 37 68 16 27 48 98 26 73 64 60 19 3 98 31 79 34 22 41 24 25 60 3 60 16 75 48 45 78 73 10 89 75 72 71 78 23

output:

0

result:

ok "0"

Test #27:

score: 0
Accepted
time: 38ms
memory: 4828kb

input:

92
84 6 82 67 94 28 67 17 58 88 80 30 74 85 17 49 76 73 15 72 77 79 74 35 64 16 61 54 38 25 68 76 91 11 83 28 58 47 39 44 2 92 68 83 23 83 95 28 78 44 62 95 62 43 31 38 50 38 25 93 19 40 79 72 56 59 9 25 24 67 20 2 25 28 49 60 30 45 10 36 90 73 67 94 20 38 71 89 68 32 56 70

output:

338893764

result:

ok "338893764"

Test #28:

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

input:

100
4 2 4 2 3 4 2 4 2 1 3 1 2 1 2 2 3 2 1 2 1 2 1 2 4 4 4 1 3 2 2 2 3 1 2 3 4 1 2 3 3 2 1 1 3 3 3 1 2 2 1 2 1 3 4 3 3 2 2 4 4 1 2 3 3 4 4 1 4 2 3 4 4 2 3 3 2 2 3 2 3 1 4 1 3 2 3 4 2 2 1 1 2 2 1 3 2 3 4 2

output:

572766636

result:

ok "572766636"

Test #29:

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

input:

100
1 1 1 1 2 4 2 1 4 3 2 2 2 4 2 2 1 1 2 1 3 1 1 4 3 4 4 3 1 3 1 2 4 3 4 3 4 3 1 4 3 1 3 1 2 2 1 1 2 1 3 4 3 4 2 3 1 1 4 4 4 1 3 2 3 4 4 4 2 3 3 2 4 1 1 3 4 4 3 2 2 2 1 4 3 2 3 4 1 1 3 2 4 2 4 1 1 1 4 3

output:

165206805

result:

ok "165206805"

Test #30:

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

input:

100
2 4 1 3 4 2 2 4 1 2 4 3 1 1 4 1 4 1 4 3 2 4 3 2 2 4 4 4 3 2 1 1 1 4 3 1 4 4 1 3 3 1 4 4 3 2 2 1 3 3 4 1 1 4 3 1 2 4 1 2 1 4 4 4 1 3 1 3 2 1 3 2 3 2 2 2 2 4 4 3 3 4 1 4 4 4 3 4 3 1 2 2 2 2 2 4 1 3 3 2

output:

76147012

result:

ok "76147012"

Test #31:

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

input:

99
3 3 3 2 3 4 3 3 3 1 2 2 1 3 4 2 2 3 2 2 4 3 3 4 3 3 3 3 3 4 2 1 2 1 2 2 3 4 3 4 1 3 4 3 4 3 1 4 3 2 3 3 2 3 3 2 2 2 4 1 3 1 2 3 1 1 4 4 4 2 4 1 4 4 4 2 4 3 2 3 2 4 2 2 1 3 1 4 4 1 2 1 2 1 2 4 3 2 2

output:

366402822

result:

ok "366402822"

Test #32:

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

input:

99
3 1 4 1 1 1 4 4 2 1 2 3 4 2 3 1 4 2 1 2 2 4 3 3 3 1 2 4 3 3 1 1 1 1 2 4 1 4 3 3 1 1 4 2 3 4 3 3 2 2 4 4 4 1 1 1 1 1 3 3 3 1 4 4 1 4 1 1 4 1 3 1 4 1 1 3 2 4 3 2 1 1 1 4 3 4 2 3 3 4 1 2 1 2 3 4 3 1 2

output:

597470544

result:

ok "597470544"

Test #33:

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

input:

99
4 4 4 3 1 3 1 1 2 3 1 2 4 3 2 4 3 4 4 3 3 3 4 4 4 3 4 1 4 2 4 3 2 4 4 3 2 1 1 4 2 2 3 3 1 1 2 1 2 3 3 4 1 1 4 1 4 3 1 2 1 3 4 2 2 4 2 4 4 2 1 4 4 2 1 3 3 3 3 4 4 2 1 2 2 3 2 3 4 4 4 3 2 1 3 2 3 2 1

output:

302222618

result:

ok "302222618"

Test #34:

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

input:

99
90 96 38 36 93 81 38 52 90 17 58 25 29 28 63 33 67 32 59 87 71 88 8 10 80 66 50 38 59 7 86 91 37 82 68 70 75 14 60 67 24 16 42 29 19 61 8 72 53 13 84 98 69 23 80 85 77 88 13 78 50 81 79 57 3 29 19 17 36 4 18 58 28 49 23 77 5 2 71 24 90 57 99 42 21 27 40 18 73 55 25 7 59 79 27 63 85 56 20

output:

219088716

result:

ok "219088716"

Test #35:

score: 0
Accepted
time: 51ms
memory: 5184kb

input:

99
51 94 96 4 71 49 53 99 35 22 97 78 91 33 15 72 54 27 91 95 12 5 79 4 50 28 43 42 19 67 41 60 35 35 97 45 24 62 66 45 5 82 2 33 83 3 79 32 13 47 84 59 91 47 72 48 33 88 80 8 84 14 72 97 41 91 96 56 94 41 31 56 27 36 44 53 46 20 65 98 80 49 13 3 14 53 71 81 9 92 92 51 19 17 31 15 23 70 80

output:

918199689

result:

ok "918199689"

Test #36:

score: 0
Accepted
time: 46ms
memory: 5172kb

input:

99
33 61 30 2 85 2 27 35 64 47 53 94 63 87 58 47 75 35 88 45 100 45 45 33 52 10 26 91 3 48 9 94 68 39 20 45 65 33 31 8 97 12 10 93 44 2 9 62 43 100 98 2 50 61 31 63 5 43 39 55 4 71 9 73 76 14 33 59 36 81 20 60 34 35 61 53 4 34 94 32 97 47 3 46 26 24 7 43 68 44 73 11 83 26 85 53 38 99 73

output:

914166196

result:

ok "914166196"

Test #37:

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

input:

99
84 40 73 93 91 15 94 18 83 43 49 48 71 29 79 18 21 64 46 35 22 20 21 57 75 59 29 52 55 4 6 49 33 75 59 92 52 22 40 64 96 100 62 24 16 70 79 80 71 30 72 63 55 90 63 40 34 48 69 48 43 47 94 71 46 32 15 43 12 71 86 73 71 22 83 89 88 55 54 44 63 60 28 59 71 74 28 3 9 79 83 44 20 5 13 18 75 7 95

output:

0

result:

ok "0"

Test #38:

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

input:

99
54 36 52 35 13 33 92 99 77 54 76 3 21 92 84 72 20 60 35 22 6 20 25 89 85 61 33 15 31 16 65 81 79 93 26 54 28 97 16 14 4 5 77 58 42 15 94 21 31 50 45 15 72 38 86 96 34 28 21 54 37 82 100 50 53 66 67 1 13 23 57 27 11 57 72 8 30 97 38 2 14 47 45 98 48 24 100 86 64 37 87 82 74 89 29 94 76 25 39

output:

0

result:

ok "0"

Test #39:

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

input:

100
38 3 61 14 72 10 96 24 28 77 34 78 5 21 11 16 18 29 17 39 25 56 63 84 82 8 30 26 17 40 37 62 15 100 58 92 44 3 71 28 13 72 70 11 75 13 58 98 72 8 24 51 8 20 89 44 2 23 99 73 65 26 57 22 59 70 19 35 33 22 26 80 29 1 76 9 28 69 6 11 5 28 77 97 49 50 62 84 45 4 99 19 55 68 28 40 51 86 5 91

output:

0

result:

ok "0"

Test #40:

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

input:

100
12 11 4 4 75 79 94 99 26 48 38 96 98 62 70 81 50 24 53 47 12 46 34 71 42 89 55 14 9 59 75 17 11 99 11 4 23 23 30 68 35 20 67 15 57 98 65 33 18 36 93 81 49 4 4 53 33 4 68 2 35 81 12 11 43 55 92 60 60 56 29 99 82 48 92 54 1 39 14 71 33 3 94 84 31 15 99 72 28 30 85 35 26 67 59 34 49 11 66 82

output:

0

result:

ok "0"

Test #41:

score: 0
Accepted
time: 59ms
memory: 5404kb

input:

100
91 60 71 71 66 94 35 70 5 38 2 47 99 8 44 87 73 39 54 56 58 66 93 54 63 47 71 35 70 13 66 88 8 88 40 71 80 15 57 29 76 58 96 59 39 97 43 10 79 61 40 67 71 15 33 13 8 87 87 52 71 82 94 60 83 84 23 96 75 86 4 32 40 5 97 78 45 100 32 82 33 60 28 98 36 24 93 78 25 63 90 89 40 27 51 65 100 9 92 95

output:

858791620

result:

ok "858791620"

Test #42:

score: 0
Accepted
time: 56ms
memory: 5524kb

input:

100
52 38 75 88 35 46 11 73 78 34 82 69 24 72 52 88 99 57 94 10 26 61 10 95 49 8 83 61 88 20 44 97 52 9 70 55 48 63 60 84 96 21 43 13 39 30 39 94 53 36 86 13 45 25 89 5 100 91 95 49 82 2 30 86 82 26 9 48 23 35 71 97 66 90 82 65 4 32 48 45 98 91 46 93 58 35 42 25 28 27 94 45 60 1 77 83 74 37 62 47

output:

738427555

result:

ok "738427555"

Test #43:

score: 0
Accepted
time: 54ms
memory: 5524kb

input:

100
66 65 14 59 31 92 57 54 15 53 87 60 92 75 43 32 98 63 15 97 79 15 68 54 9 92 82 2 62 100 18 95 96 22 35 89 88 4 11 49 68 63 29 22 5 66 16 46 34 66 44 30 24 28 84 80 87 17 2 44 92 36 75 95 49 86 86 52 56 49 95 57 43 43 82 84 19 70 74 37 5 70 33 50 16 84 90 25 7 68 75 62 59 4 7 54 45 28 49 66

output:

699293570

result:

ok "699293570"

Test #44:

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

input:

100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

35305197

result:

ok "35305197"

Test #45:

score: 0
Accepted
time: 44ms
memory: 4920kb

input:

99
33 47 61 23 17 22 65 2 57 75 32 72 54 20 59 21 5 53 31 51 50 3 62 44 66 82 71 75 74 72 78 43 34 6 64 30 17 4 48 85 52 49 36 41 79 68 44 45 39 63 63 70 16 84 24 84 18 14 12 28 15 67 37 34 76 46 5 14 60 10 13 80 81 8 58 73 27 84 26 40 19 56 42 7 55 75 11 35 25 83 19 81 38 8 77 69 9 29 59

output:

905104398

result:

ok "905104398"

Test #46:

score: 0
Accepted
time: 44ms
memory: 4828kb

input:

99
67 24 58 28 1 51 46 63 17 38 7 60 29 13 40 57 71 82 86 6 19 5 12 70 55 22 66 44 53 27 59 65 2 32 88 50 69 18 1 48 43 9 74 45 33 31 60 23 34 52 8 76 77 79 16 11 49 87 54 30 15 4 42 83 20 88 36 64 85 25 78 85 88 47 48 61 26 73 14 39 14 56 10 81 21 68 14 37 66 72 75 3 80 35 41 23 62 27 84

output:

312550131

result:

ok "312550131"

Test #47:

score: 0
Accepted
time: 40ms
memory: 4608kb

input:

100
25 26 19 32 5 3 24 55 35 58 76 43 17 29 77 5 43 73 45 21 65 4 7 62 37 54 37 44 14 21 63 49 66 14 53 50 13 57 41 63 6 17 27 23 9 11 12 77 60 1 42 46 52 56 8 8 30 18 9 63 48 22 10 36 77 52 79 78 70 34 37 51 69 72 33 75 59 62 74 47 68 31 14 16 61 71 28 38 39 64 20 23 23 9 2 7 40 67 35 15

output:

513464322

result:

ok "513464322"

Test #48:

score: 0
Accepted
time: 46ms
memory: 5256kb

input:

100
22 40 75 44 53 17 48 76 38 36 82 72 10 63 50 70 46 52 60 37 42 26 56 51 66 35 21 9 80 49 70 65 31 82 73 32 23 5 67 39 47 65 62 71 77 83 61 81 11 62 54 41 8 24 14 42 16 7 19 60 27 59 43 12 78 58 45 6 34 62 13 64 25 68 74 29 84 3 18 15 20 58 69 30 83 33 2 55 6 57 82 80 4 79 28 19 30 19 73 82

output:

294800349

result:

ok "294800349"

Test #49:

score: 0
Accepted
time: 101ms
memory: 7268kb

input:

100
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 ...

output:

35305197

result:

ok "35305197"

Test #50:

score: 0
Accepted
time: 53ms
memory: 5092kb

input:

100
92 79 24 69 100 10 38 53 3 21 73 32 7 27 37 28 49 51 86 91 77 89 5 55 19 81 47 65 57 44 72 50 6 64 11 29 83 60 74 87 36 15 68 93 62 12 34 4 43 80 42 56 78 1 9 70 88 66 18 20 17 94 33 39 99 46 95 35 31 90 2 98 84 82 59 97 85 45 52 8 63 48 25 16 41 76 54 23 13 61 14 58 75 30 40 26 67 71 96 22

output:

854040496

result:

ok "854040496"

Test #51:

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

input:

100
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 ...

output:

0

result:

ok "0"

Test #52:

score: 0
Accepted
time: 95ms
memory: 6952kb

input:

100
97 100 99 99 95 98 99 99 97 97 100 97 97 96 98 96 97 95 95 96 95 99 99 99 95 97 99 100 95 97 99 97 95 96 98 95 98 97 98 99 96 97 97 95 100 99 98 100 100 100 95 95 97 99 100 95 97 100 100 95 99 96 95 95 95 97 99 95 100 98 95 98 98 100 98 96 97 100 99 100 99 95 99 97 98 100 100 99 96 98 95 100 97 ...

output:

640494053

result:

ok "640494053"

Test #53:

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

input:

100
100 100 95 95 98 98 100 96 99 95 99 96 97 100 98 99 96 99 97 98 96 96 95 98 97 97 99 98 100 95 97 97 100 98 99 100 98 99 97 96 99 98 100 98 95 96 99 99 97 96 99 100 98 99 97 95 100 97 99 96 98 98 95 96 97 95 98 99 99 96 97 96 98 96 100 98 96 97 97 95 97 100 99 99 100 98 98 96 95 97 100 100 99 97...

output:

525329040

result:

ok "525329040"

Extra Test:

score: 0
Extra Test Passed