QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#632034 | #9443. Left Equals Right | ucup-team1134 | AC ✓ | 64ms | 219404kb | C++23 | 17.6kb | 2024-10-12 11:36:21 | 2024-10-12 11:36:23 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=105,INF=15<<26;
//modint + 逆元テーブル
// from: https://gist.github.com/yosupo06/ddd51afb727600fd95d9d8ad6c3c80c9
// (based on AtCoder STL)
#include <cassert>
#include <numeric>
#include <type_traits>
namespace atcoder {
namespace internal {
#ifndef _MSC_VER
template <class T>
using is_signed_int128 =
typename std::conditional<std::is_same<T, __int128_t>::value ||
std::is_same<T, __int128>::value,
std::true_type,
std::false_type>::type;
template <class T>
using is_unsigned_int128 =
typename std::conditional<std::is_same<T, __uint128_t>::value ||
std::is_same<T, unsigned __int128>::value,
std::true_type,
std::false_type>::type;
template <class T>
using make_unsigned_int128 =
typename std::conditional<std::is_same<T, __int128_t>::value,
__uint128_t,
unsigned __int128>;
template <class T>
using is_integral = typename std::conditional<std::is_integral<T>::value ||
is_signed_int128<T>::value ||
is_unsigned_int128<T>::value,
std::true_type,
std::false_type>::type;
template <class T>
using is_signed_int = typename std::conditional<(is_integral<T>::value &&
std::is_signed<T>::value) ||
is_signed_int128<T>::value,
std::true_type,
std::false_type>::type;
template <class T>
using is_unsigned_int =
typename std::conditional<(is_integral<T>::value &&
std::is_unsigned<T>::value) ||
is_unsigned_int128<T>::value,
std::true_type,
std::false_type>::type;
template <class T>
using to_unsigned = typename std::conditional<
is_signed_int128<T>::value,
make_unsigned_int128<T>,
typename std::conditional<std::is_signed<T>::value,
std::make_unsigned<T>,
std::common_type<T>>::type>::type;
#else
template <class T> using is_integral = typename std::is_integral<T>;
template <class T>
using is_signed_int =
typename std::conditional<is_integral<T>::value && std::is_signed<T>::value,
std::true_type,
std::false_type>::type;
template <class T>
using is_unsigned_int =
typename std::conditional<is_integral<T>::value &&
std::is_unsigned<T>::value,
std::true_type,
std::false_type>::type;
template <class T>
using to_unsigned = typename std::conditional<is_signed_int<T>::value,
std::make_unsigned<T>,
std::common_type<T>>::type;
#endif
template <class T>
using is_signed_int_t = std::enable_if_t<is_signed_int<T>::value>;
template <class T>
using is_unsigned_int_t = std::enable_if_t<is_unsigned_int<T>::value>;
template <class T> using to_unsigned_t = typename to_unsigned<T>::type;
} // namespace internal
} // namespace atcoder
#include <utility>
namespace atcoder {
namespace internal {
constexpr long long safe_mod(long long x, long long m) {
x %= m;
if (x < 0) x += m;
return x;
}
struct barrett {
unsigned int _m;
unsigned long long im;
barrett(unsigned int m) : _m(m), im((unsigned long long)(-1) / m + 1) {}
unsigned int umod() const { return _m; }
unsigned int mul(unsigned int a, unsigned int b) const {
unsigned long long z = a;
z *= b;
#ifdef _MSC_VER
unsigned long long x;
_umul128(z, im, &x);
#else
unsigned long long x =
(unsigned long long)(((unsigned __int128)(z)*im) >> 64);
#endif
unsigned int v = (unsigned int)(z - x * _m);
if (_m <= v) v += _m;
return v;
}
};
constexpr long long pow_mod_constexpr(long long x, long long n, int m) {
if (m == 1) return 0;
unsigned int _m = (unsigned int)(m);
unsigned long long r = 1;
unsigned long long y = safe_mod(x, m);
while (n) {
if (n & 1) r = (r * y) % _m;
y = (y * y) % _m;
n >>= 1;
}
return r;
}
constexpr bool is_prime_constexpr(int n) {
if (n <= 1) return false;
if (n == 2 || n == 7 || n == 61) return true;
if (n % 2 == 0) return false;
long long d = n - 1;
while (d % 2 == 0) d /= 2;
for (long long a : {2, 7, 61}) {
long long t = d;
long long y = pow_mod_constexpr(a, t, n);
while (t != n - 1 && y != 1 && y != n - 1) {
y = y * y % n;
t <<= 1;
}
if (y != n - 1 && t % 2 == 0) {
return false;
}
}
return true;
}
template <int n> constexpr bool is_prime = is_prime_constexpr(n);
constexpr std::pair<long long, long long> inv_gcd(long long a, long long b) {
a = safe_mod(a, b);
if (a == 0) return {b, 0};
long long s = b, t = a;
long long m0 = 0, m1 = 1;
while (t) {
long long u = s / t;
s -= t * u;
m0 -= m1 * u; // |m1 * u| <= |m1| * s <= b
auto tmp = s;
s = t;
t = tmp;
tmp = m0;
m0 = m1;
m1 = tmp;
}
if (m0 < 0) m0 += b / s;
return {s, m0};
}
constexpr int primitive_root_constexpr(int m) {
if (m == 2) return 1;
if (m == 167772161) return 3;
if (m == 469762049) return 3;
if (m == 754974721) return 11;
if (m == 998244353) return 3;
int divs[20] = {};
divs[0] = 2;
int cnt = 1;
int x = (m - 1) / 2;
while (x % 2 == 0) x /= 2;
for (int i = 3; (long long)(i)*i <= x; i += 2) {
if (x % i == 0) {
divs[cnt++] = i;
while (x % i == 0) {
x /= i;
}
}
}
if (x > 1) {
divs[cnt++] = x;
}
for (int g = 2;; g++) {
bool ok = true;
for (int i = 0; i < cnt; i++) {
if (pow_mod_constexpr(g, (m - 1) / divs[i], m) == 1) {
ok = false;
break;
}
}
if (ok) return g;
}
}
template <int m> constexpr int primitive_root = primitive_root_constexpr(m);
} // namespace internal
} // namespace atcoder
#include <cassert>
#include <numeric>
#include <type_traits>
#ifdef _MSC_VER
#include <intrin.h>
#endif
namespace atcoder {
namespace internal {
struct modint_base {};
struct static_modint_base : modint_base {};
template <class T> using is_modint = std::is_base_of<modint_base, T>;
template <class T> using is_modint_t = std::enable_if_t<is_modint<T>::value>;
} // namespace internal
template <int m, std::enable_if_t<(1 <= m)>* = nullptr>
struct static_modint : internal::static_modint_base {
using mint = static_modint;
public:
static constexpr int mod() { return m; }
static mint raw(int v) {
mint x;
x._v = v;
return x;
}
static_modint() : _v(0) {}
template <class T, internal::is_signed_int_t<T>* = nullptr>
static_modint(T v) {
long long x = (long long)(v % (long long)(umod()));
if (x < 0) x += umod();
_v = (unsigned int)(x);
}
template <class T, internal::is_unsigned_int_t<T>* = nullptr>
static_modint(T v) {
_v = (unsigned int)(v % umod());
}
static_modint(bool v) { _v = ((unsigned int)(v) % umod()); }
unsigned int val() const { return _v; }
mint& operator++() {
_v++;
if (_v == umod()) _v = 0;
return *this;
}
mint& operator--() {
if (_v == 0) _v = umod();
_v--;
return *this;
}
mint operator++(int) {
mint result = *this;
++*this;
return result;
}
mint operator--(int) {
mint result = *this;
--*this;
return result;
}
mint& operator+=(const mint& rhs) {
_v += rhs._v;
if (_v >= umod()) _v -= umod();
return *this;
}
mint& operator-=(const mint& rhs) {
_v -= rhs._v;
if (_v >= umod()) _v += umod();
return *this;
}
mint& operator*=(const mint& rhs) {
unsigned long long z = _v;
z *= rhs._v;
_v = (unsigned int)(z % umod());
return *this;
}
mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }
mint operator+() const { return *this; }
mint operator-() const { return mint() - *this; }
mint pow(long long n) const {
assert(0 <= n);
mint x = *this, r = 1;
while (n) {
if (n & 1) r *= x;
x *= x;
n >>= 1;
}
return r;
}
mint inv() const {
if (prime) {
assert(_v);
return pow(umod() - 2);
} else {
auto eg = internal::inv_gcd(_v, m);
assert(eg.first == 1);
return eg.second;
}
}
friend mint operator+(const mint& lhs, const mint& rhs) {
return mint(lhs) += rhs;
}
friend mint operator-(const mint& lhs, const mint& rhs) {
return mint(lhs) -= rhs;
}
friend mint operator*(const mint& lhs, const mint& rhs) {
return mint(lhs) *= rhs;
}
friend mint operator/(const mint& lhs, const mint& rhs) {
return mint(lhs) /= rhs;
}
friend bool operator==(const mint& lhs, const mint& rhs) {
return lhs._v == rhs._v;
}
friend bool operator!=(const mint& lhs, const mint& rhs) {
return lhs._v != rhs._v;
}
private:
unsigned int _v;
static constexpr unsigned int umod() { return m; }
static constexpr bool prime = internal::is_prime<m>;
};
template <int id> struct dynamic_modint : internal::modint_base {
using mint = dynamic_modint;
public:
static int mod() { return (int)(bt.umod()); }
static void set_mod(int m) {
assert(1 <= m);
bt = internal::barrett(m);
}
static mint raw(int v) {
mint x;
x._v = v;
return x;
}
dynamic_modint() : _v(0) {}
template <class T, internal::is_signed_int_t<T>* = nullptr>
dynamic_modint(T v) {
long long x = (long long)(v % (long long)(mod()));
if (x < 0) x += mod();
_v = (unsigned int)(x);
}
template <class T, internal::is_unsigned_int_t<T>* = nullptr>
dynamic_modint(T v) {
_v = (unsigned int)(v % mod());
}
dynamic_modint(bool v) { _v = ((unsigned int)(v) % mod()); }
unsigned int val() const { return _v; }
mint& operator++() {
_v++;
if (_v == umod()) _v = 0;
return *this;
}
mint& operator--() {
if (_v == 0) _v = umod();
_v--;
return *this;
}
mint operator++(int) {
mint result = *this;
++*this;
return result;
}
mint operator--(int) {
mint result = *this;
--*this;
return result;
}
mint& operator+=(const mint& rhs) {
_v += rhs._v;
if (_v >= umod()) _v -= umod();
return *this;
}
mint& operator-=(const mint& rhs) {
_v += mod() - rhs._v;
if (_v >= umod()) _v -= umod();
return *this;
}
mint& operator*=(const mint& rhs) {
_v = bt.mul(_v, rhs._v);
return *this;
}
mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }
mint operator+() const { return *this; }
mint operator-() const { return mint() - *this; }
mint pow(long long n) const {
assert(0 <= n);
mint x = *this, r = 1;
while (n) {
if (n & 1) r *= x;
x *= x;
n >>= 1;
}
return r;
}
mint inv() const {
auto eg = internal::inv_gcd(_v, mod());
assert(eg.first == 1);
return eg.second;
}
friend mint operator+(const mint& lhs, const mint& rhs) {
return mint(lhs) += rhs;
}
friend mint operator-(const mint& lhs, const mint& rhs) {
return mint(lhs) -= rhs;
}
friend mint operator*(const mint& lhs, const mint& rhs) {
return mint(lhs) *= rhs;
}
friend mint operator/(const mint& lhs, const mint& rhs) {
return mint(lhs) /= rhs;
}
friend bool operator==(const mint& lhs, const mint& rhs) {
return lhs._v == rhs._v;
}
friend bool operator!=(const mint& lhs, const mint& rhs) {
return lhs._v != rhs._v;
}
private:
unsigned int _v;
static internal::barrett bt;
static unsigned int umod() { return bt.umod(); }
};
template <int id> internal::barrett dynamic_modint<id>::bt = 998244353;
using modint998244353 = static_modint<998244353>;
using modint1000000007 = static_modint<1000000007>;
using modint = dynamic_modint<-1>;
namespace internal {
template <class T>
using is_static_modint = std::is_base_of<internal::static_modint_base, T>;
template <class T>
using is_static_modint_t = std::enable_if_t<is_static_modint<T>::value>;
template <class> struct is_dynamic_modint : public std::false_type {};
template <int id>
struct is_dynamic_modint<dynamic_modint<id>> : public std::true_type {};
template <class T>
using is_dynamic_modint_t = std::enable_if_t<is_dynamic_modint<T>::value>;
} // namespace internal
} // namespace atcoder
using mint=atcoder::modint998244353;
mint inv[MAX],fac[MAX],finv[MAX];
void make(){
fac[0]=fac[1]=1;
finv[0]=finv[1]=1;
inv[1]=1;
for(int i=2;i<MAX;i++){
inv[i]=-inv[mod%i]*(mod/i);
fac[i]=fac[i-1]*i;
finv[i]=finv[i-1]*inv[i];
}
}
mint comb(ll a,ll b){
if(a<b) return 0;
return fac[a]*finv[b]*finv[a-b];
}
mint perm(ll a,ll b){
if(a<b) return 0;
return fac[a]*finv[a-b];
}
mint dp[MAX][MAX][5005];
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
make();
ll M=100;
ll N;cin>>N;
vector<ll> CN(M+1);
ll sum=0;
for(int i=0;i<N;i++){
ll x;cin>>x;
CN[x]++;
sum+=x;
}
if(sum&1){
cout<<0<<endl;
return 0;
}
dp[0][0][0]=1;
for(int i=0;i<=M;i++){
for(int j=0;j<=N;j++){
for(int k=0;k<=sum/2;k++){
if(dp[i][j][k]==0) continue;
for(int x=0;x<=CN[i];x++){
if(k+i*x>sum/2) break;
dp[i+1][j+x][k+i*x]+=dp[i][j][k]*comb(CN[i],x);
}
}
}
}
mint ans=0;
for(int j=0;j<=N;j++){
ans+=dp[M+1][j][sum/2]*fac[j]*fac[N-j];
}
cout<<ans.val()<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 11ms
memory: 219064kb
input:
3 4 9 5
output:
4
result:
ok "4"
Test #2:
score: 0
Accepted
time: 8ms
memory: 219104kb
input:
2 100 100
output:
2
result:
ok "2"
Test #3:
score: 0
Accepted
time: 7ms
memory: 219156kb
input:
8 3 2 6 3 1 2 4 5
output:
11520
result:
ok "11520"
Test #4:
score: 0
Accepted
time: 11ms
memory: 219384kb
input:
2 93 93
output:
2
result:
ok "2"
Test #5:
score: 0
Accepted
time: 0ms
memory: 219160kb
input:
2 62 45
output:
0
result:
ok "0"
Test #6:
score: 0
Accepted
time: 7ms
memory: 219100kb
input:
3 32 68 36
output:
4
result:
ok "4"
Test #7:
score: 0
Accepted
time: 0ms
memory: 219156kb
input:
3 27 2 25
output:
4
result:
ok "4"
Test #8:
score: 0
Accepted
time: 8ms
memory: 219104kb
input:
10 38 27 36 88 77 25 73 44 11 21
output:
126720
result:
ok "126720"
Test #9:
score: 0
Accepted
time: 7ms
memory: 219100kb
input:
10 93 78 29 81 14 20 18 71 85 48
output:
0
result:
ok "0"
Test #10:
score: 0
Accepted
time: 15ms
memory: 219092kb
input:
9 57 19 88 13 55 43 27 10 74
output:
5760
result:
ok "5760"
Test #11:
score: 0
Accepted
time: 4ms
memory: 219100kb
input:
10 80 1 44 85 32 85 3 4 80 45
output:
0
result:
ok "0"
Test #12:
score: 0
Accepted
time: 7ms
memory: 219092kb
input:
10 56 72 93 39 70 78 3 10 84 48
output:
0
result:
ok "0"
Test #13:
score: 0
Accepted
time: 3ms
memory: 219116kb
input:
10 2 58 36 81 100 85 11 39 24 50
output:
118080
result:
ok "118080"
Test #14:
score: 0
Accepted
time: 4ms
memory: 219104kb
input:
10 70 23 3 26 98 18 63 32 22 25
output:
158400
result:
ok "158400"
Test #15:
score: 0
Accepted
time: 11ms
memory: 219192kb
input:
10 42 92 12 71 85 68 78 89 98 30
output:
0
result:
ok "0"
Test #16:
score: 0
Accepted
time: 8ms
memory: 219156kb
input:
10 26 5 25 35 77 46 81 13 73 32
output:
0
result:
ok "0"
Test #17:
score: 0
Accepted
time: 15ms
memory: 219168kb
input:
10 37 43 7 51 89 86 84 26 28 15
output:
103680
result:
ok "103680"
Test #18:
score: 0
Accepted
time: 15ms
memory: 219172kb
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: 11ms
memory: 219168kb
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: 11ms
memory: 219104kb
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: 4ms
memory: 219356kb
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: 7ms
memory: 219356kb
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: 31ms
memory: 219156kb
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: 16ms
memory: 219104kb
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: 15ms
memory: 219172kb
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: 7ms
memory: 219388kb
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: 43ms
memory: 219092kb
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: 16ms
memory: 219324kb
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: 19ms
memory: 219388kb
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: 11ms
memory: 219396kb
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: 18ms
memory: 219100kb
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: 7ms
memory: 219104kb
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: 11ms
memory: 219328kb
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: 39ms
memory: 219092kb
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: 47ms
memory: 219400kb
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: 43ms
memory: 219396kb
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: 4ms
memory: 219108kb
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: 7ms
memory: 219352kb
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: 15ms
memory: 219160kb
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: 16ms
memory: 219388kb
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: 55ms
memory: 219104kb
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: 48ms
memory: 219200kb
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: 43ms
memory: 219156kb
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: 8ms
memory: 219404kb
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: 64ms
memory: 219332kb
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: 39ms
memory: 219188kb
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: 45ms
memory: 219104kb
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: 219160kb
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: 30ms
memory: 219092kb
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: 48ms
memory: 219108kb
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: 7ms
memory: 219400kb
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: 31ms
memory: 219096kb
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: 36ms
memory: 219104kb
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