QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#625512 | #9443. Left Equals Right | maspy | AC ✓ | 39ms | 5340kb | C++20 | 19.6kb | 2024-10-09 19:35:15 | 2024-10-09 19:35:16 |
Judging History
answer
#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
// https://codeforces.com/blog/entry/96344
#pragma GCC optimize("Ofast,unroll-loops")
// いまの CF だとこれ入れると動かない?
// #pragma GCC target("avx2,popcnt")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i128 = __int128;
using u128 = unsigned __int128;
using f128 = __float128;
template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'010'000'000;
template <>
constexpr ll infty<ll> = 2'020'000'000'000'000'000;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * 2'000'000'000'000'000'000;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;
using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...) \
vector<vector<vector<vector<type>>>> name(a, vector<vector<vector<type>>>(b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))
// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)
#define FOR_subset(t, s) for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define stoi stoll
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
int popcnt_mod_2(int x) { return __builtin_parity(x); }
int popcnt_mod_2(u32 x) { return __builtin_parity(x); }
int popcnt_mod_2(ll x) { return __builtin_parityll(x); }
int popcnt_mod_2(u64 x) { return __builtin_parityll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
template <typename T>
T floor(T a, T b) {
return a / b - (a % b && (a ^ b) < 0);
}
template <typename T>
T ceil(T x, T y) {
return floor(x + y - 1, y);
}
template <typename T>
T bmod(T x, T y) {
return x - y * floor(x, y);
}
template <typename T>
pair<T, T> divmod(T x, T y) {
T q = floor(x, y);
return {q, x - q * y};
}
template <typename T, typename U>
T SUM(const vector<U> &A) {
T sm = 0;
for (auto &&a: A) sm += a;
return sm;
}
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()
template <typename T>
T POP(deque<T> &que) {
T a = que.front();
que.pop_front();
return a;
}
template <typename T>
T POP(pq<T> &que) {
T a = que.top();
que.pop();
return a;
}
template <typename T>
T POP(pqg<T> &que) {
T a = que.top();
que.pop();
return a;
}
template <typename T>
T POP(vc<T> &que) {
T a = que.back();
que.pop_back();
return a;
}
template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
if (check_ok) assert(check(ok));
while (abs(ok - ng) > 1) {
auto x = (ng + ok) / 2;
(check(x) ? ok : ng) = x;
}
return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
FOR(iter) {
double x = (ok + ng) / 2;
(check(x) ? ok : ng) = x;
}
return (ok + ng) / 2;
}
template <class T, class S>
inline bool chmax(T &a, const S &b) {
return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
return (a > b ? a = b, 1 : 0);
}
// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
vc<int> A(S.size());
FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
return A;
}
template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
int N = A.size();
vector<T> B(N + 1);
FOR(i, N) { B[i + 1] = B[i] + A[i]; }
if (off == 0) B.erase(B.begin());
return B;
}
// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
vector<int> ids(len(A));
iota(all(ids), 0);
sort(all(ids), [&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
return ids;
}
// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
vc<T> B(len(I));
FOR(i, len(I)) B[i] = A[I[i]];
return B;
}
template <typename T, typename... Vectors>
void concat(vc<T> &first, const Vectors &... others) {
vc<T> &res = first;
(res.insert(res.end(), others.begin(), others.end()), ...);
}
#endif
#line 1 "library/other/io.hpp"
#define FASTIO
#include <unistd.h>
// https://judge.yosupo.jp/submission/21623
namespace fastio {
static constexpr uint32_t SZ = 1 << 17;
char ibuf[SZ];
char obuf[SZ];
char out[100];
// pointer of ibuf, obuf
uint32_t pil = 0, pir = 0, por = 0;
struct Pre {
char num[10000][4];
constexpr Pre() : num() {
for (int i = 0; i < 10000; i++) {
int n = i;
for (int j = 3; j >= 0; j--) {
num[i][j] = n % 10 | '0';
n /= 10;
}
}
}
} constexpr pre;
inline void load() {
memcpy(ibuf, ibuf + pil, pir - pil);
pir = pir - pil + fread(ibuf + pir - pil, 1, SZ - pir + pil, stdin);
pil = 0;
if (pir < SZ) ibuf[pir++] = '\n';
}
inline void flush() {
fwrite(obuf, 1, por, stdout);
por = 0;
}
void rd(char &c) {
do {
if (pil + 1 > pir) load();
c = ibuf[pil++];
} while (isspace(c));
}
void rd(string &x) {
x.clear();
char c;
do {
if (pil + 1 > pir) load();
c = ibuf[pil++];
} while (isspace(c));
do {
x += c;
if (pil == pir) load();
c = ibuf[pil++];
} while (!isspace(c));
}
template <typename T>
void rd_real(T &x) {
string s;
rd(s);
x = stod(s);
}
template <typename T>
void rd_integer(T &x) {
if (pil + 100 > pir) load();
char c;
do
c = ibuf[pil++];
while (c < '-');
bool minus = 0;
if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
if (c == '-') { minus = 1, c = ibuf[pil++]; }
}
x = 0;
while ('0' <= c) { x = x * 10 + (c & 15), c = ibuf[pil++]; }
if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
if (minus) x = -x;
}
}
void rd(int &x) { rd_integer(x); }
void rd(ll &x) { rd_integer(x); }
void rd(i128 &x) { rd_integer(x); }
void rd(u32 &x) { rd_integer(x); }
void rd(u64 &x) { rd_integer(x); }
void rd(u128 &x) { rd_integer(x); }
void rd(double &x) { rd_real(x); }
void rd(long double &x) { rd_real(x); }
void rd(f128 &x) { rd_real(x); }
template <class T, class U>
void rd(pair<T, U> &p) {
return rd(p.first), rd(p.second);
}
template <size_t N = 0, typename T>
void rd_tuple(T &t) {
if constexpr (N < std::tuple_size<T>::value) {
auto &x = std::get<N>(t);
rd(x);
rd_tuple<N + 1>(t);
}
}
template <class... T>
void rd(tuple<T...> &tpl) {
rd_tuple(tpl);
}
template <size_t N = 0, typename T>
void rd(array<T, N> &x) {
for (auto &d: x) rd(d);
}
template <class T>
void rd(vc<T> &x) {
for (auto &d: x) rd(d);
}
void read() {}
template <class H, class... T>
void read(H &h, T &... t) {
rd(h), read(t...);
}
void wt(const char c) {
if (por == SZ) flush();
obuf[por++] = c;
}
void wt(const string s) {
for (char c: s) wt(c);
}
void wt(const char *s) {
size_t len = strlen(s);
for (size_t i = 0; i < len; i++) wt(s[i]);
}
template <typename T>
void wt_integer(T x) {
if (por > SZ - 100) flush();
if (x < 0) { obuf[por++] = '-', x = -x; }
int outi;
for (outi = 96; x >= 10000; outi -= 4) {
memcpy(out + outi, pre.num[x % 10000], 4);
x /= 10000;
}
if (x >= 1000) {
memcpy(obuf + por, pre.num[x], 4);
por += 4;
} else if (x >= 100) {
memcpy(obuf + por, pre.num[x] + 1, 3);
por += 3;
} else if (x >= 10) {
int q = (x * 103) >> 10;
obuf[por] = q | '0';
obuf[por + 1] = (x - q * 10) | '0';
por += 2;
} else
obuf[por++] = x | '0';
memcpy(obuf + por, out + outi + 4, 96 - outi);
por += 96 - outi;
}
template <typename T>
void wt_real(T x) {
ostringstream oss;
oss << fixed << setprecision(15) << double(x);
string s = oss.str();
wt(s);
}
void wt(int x) { wt_integer(x); }
void wt(ll x) { wt_integer(x); }
void wt(i128 x) { wt_integer(x); }
void wt(u32 x) { wt_integer(x); }
void wt(u64 x) { wt_integer(x); }
void wt(u128 x) { wt_integer(x); }
void wt(double x) { wt_real(x); }
void wt(long double x) { wt_real(x); }
void wt(f128 x) { wt_real(x); }
template <class T, class U>
void wt(const pair<T, U> val) {
wt(val.first);
wt(' ');
wt(val.second);
}
template <size_t N = 0, typename T>
void wt_tuple(const T t) {
if constexpr (N < std::tuple_size<T>::value) {
if constexpr (N > 0) { wt(' '); }
const auto x = std::get<N>(t);
wt(x);
wt_tuple<N + 1>(t);
}
}
template <class... T>
void wt(tuple<T...> tpl) {
wt_tuple(tpl);
}
template <class T, size_t S>
void wt(const array<T, S> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) wt(' ');
wt(val[i]);
}
}
template <class T>
void wt(const vector<T> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) wt(' ');
wt(val[i]);
}
}
void print() { wt('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
wt(head);
if (sizeof...(Tail)) wt(' ');
print(forward<Tail>(tail)...);
}
// gcc expansion. called automaticall after main.
void __attribute__((destructor)) _d() { flush(); }
} // namespace fastio
using fastio::read;
using fastio::print;
using fastio::flush;
#if defined(LOCAL)
#define SHOW(...) SHOW_IMPL(__VA_ARGS__, SHOW6, SHOW5, SHOW4, SHOW3, SHOW2, SHOW1)(__VA_ARGS__)
#define SHOW_IMPL(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
#define SHOW1(x) print(#x, "=", (x)), flush()
#define SHOW2(x, y) print(#x, "=", (x), #y, "=", (y)), flush()
#define SHOW3(x, y, z) print(#x, "=", (x), #y, "=", (y), #z, "=", (z)), flush()
#define SHOW4(x, y, z, w) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w)), flush()
#define SHOW5(x, y, z, w, v) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v)), flush()
#define SHOW6(x, y, z, w, v, u) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v), #u, "=", (u)), flush()
#else
#define SHOW(...)
#endif
#define INT(...) \
int __VA_ARGS__; \
read(__VA_ARGS__)
#define LL(...) \
ll __VA_ARGS__; \
read(__VA_ARGS__)
#define U32(...) \
u32 __VA_ARGS__; \
read(__VA_ARGS__)
#define U64(...) \
u64 __VA_ARGS__; \
read(__VA_ARGS__)
#define STR(...) \
string __VA_ARGS__; \
read(__VA_ARGS__)
#define CHAR(...) \
char __VA_ARGS__; \
read(__VA_ARGS__)
#define DBL(...) \
double __VA_ARGS__; \
read(__VA_ARGS__)
#define VEC(type, name, size) \
vector<type> name(size); \
read(name)
#define VV(type, name, h, w) \
vector<vector<type>> name(h, vector<type>(w)); \
read(name)
void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"
#line 2 "library/mod/modint_common.hpp"
struct has_mod_impl {
template <class T>
static auto check(T &&x) -> decltype(x.get_mod(), std::true_type{});
template <class T>
static auto check(...) -> std::false_type;
};
template <class T>
class has_mod : public decltype(has_mod_impl::check<T>(std::declval<T>())) {};
template <typename mint>
mint inv(int n) {
static const int mod = mint::get_mod();
static vector<mint> dat = {0, 1};
assert(0 <= n);
if (n >= mod) n %= mod;
while (len(dat) <= n) {
int k = len(dat);
int q = (mod + k - 1) / k;
dat.eb(dat[k * q - mod] * mint::raw(q));
}
return dat[n];
}
template <typename mint>
mint fact(int n) {
static const int mod = mint::get_mod();
assert(0 <= n && n < mod);
static vector<mint> dat = {1, 1};
while (len(dat) <= n) dat.eb(dat[len(dat) - 1] * mint::raw(len(dat)));
return dat[n];
}
template <typename mint>
mint fact_inv(int n) {
static vector<mint> dat = {1, 1};
if (n < 0) return mint(0);
while (len(dat) <= n) dat.eb(dat[len(dat) - 1] * inv<mint>(len(dat)));
return dat[n];
}
template <class mint, class... Ts>
mint fact_invs(Ts... xs) {
return (mint(1) * ... * fact_inv<mint>(xs));
}
template <typename mint, class Head, class... Tail>
mint multinomial(Head &&head, Tail &&... tail) {
return fact<mint>(head) * fact_invs<mint>(std::forward<Tail>(tail)...);
}
template <typename mint>
mint C_dense(int n, int k) {
static vvc<mint> C;
static int H = 0, W = 0;
auto calc = [&](int i, int j) -> mint {
if (i == 0) return (j == 0 ? mint(1) : mint(0));
return C[i - 1][j] + (j ? C[i - 1][j - 1] : 0);
};
if (W <= k) {
FOR(i, H) {
C[i].resize(k + 1);
FOR(j, W, k + 1) { C[i][j] = calc(i, j); }
}
W = k + 1;
}
if (H <= n) {
C.resize(n + 1);
FOR(i, H, n + 1) {
C[i].resize(W);
FOR(j, W) { C[i][j] = calc(i, j); }
}
H = n + 1;
}
return C[n][k];
}
template <typename mint, bool large = false, bool dense = false>
mint C(ll n, ll k) {
assert(n >= 0);
if (k < 0 || n < k) return 0;
if constexpr (dense) return C_dense<mint>(n, k);
if constexpr (!large) return multinomial<mint>(n, k, n - k);
k = min(k, n - k);
mint x(1);
FOR(i, k) x *= mint(n - i);
return x * fact_inv<mint>(k);
}
template <typename mint, bool large = false>
mint C_inv(ll n, ll k) {
assert(n >= 0);
assert(0 <= k && k <= n);
if (!large) return fact_inv<mint>(n) * fact<mint>(k) * fact<mint>(n - k);
return mint(1) / C<mint, 1>(n, k);
}
// [x^d](1-x)^{-n}
template <typename mint, bool large = false, bool dense = false>
mint C_negative(ll n, ll d) {
assert(n >= 0);
if (d < 0) return mint(0);
if (n == 0) { return (d == 0 ? mint(1) : mint(0)); }
return C<mint, large, dense>(n + d - 1, d);
}
#line 3 "library/mod/modint.hpp"
template <int mod>
struct modint {
static constexpr u32 umod = u32(mod);
static_assert(umod < u32(1) << 31);
u32 val;
static modint raw(u32 v) {
modint x;
x.val = v;
return x;
}
constexpr modint() : val(0) {}
constexpr modint(u32 x) : val(x % umod) {}
constexpr modint(u64 x) : val(x % umod) {}
constexpr modint(u128 x) : val(x % umod) {}
constexpr modint(int x) : val((x %= mod) < 0 ? x + mod : x){};
constexpr modint(ll x) : val((x %= mod) < 0 ? x + mod : x){};
constexpr modint(i128 x) : val((x %= mod) < 0 ? x + mod : x){};
bool operator<(const modint &other) const { return val < other.val; }
modint &operator+=(const modint &p) {
if ((val += p.val) >= umod) val -= umod;
return *this;
}
modint &operator-=(const modint &p) {
if ((val += umod - p.val) >= umod) val -= umod;
return *this;
}
modint &operator*=(const modint &p) {
val = u64(val) * p.val % umod;
return *this;
}
modint &operator/=(const modint &p) {
*this *= p.inverse();
return *this;
}
modint operator-() const { return modint::raw(val ? mod - val : u32(0)); }
modint operator+(const modint &p) const { return modint(*this) += p; }
modint operator-(const modint &p) const { return modint(*this) -= p; }
modint operator*(const modint &p) const { return modint(*this) *= p; }
modint operator/(const modint &p) const { return modint(*this) /= p; }
bool operator==(const modint &p) const { return val == p.val; }
bool operator!=(const modint &p) const { return val != p.val; }
modint inverse() const {
int a = val, b = mod, u = 1, v = 0, t;
while (b > 0) {
t = a / b;
swap(a -= t * b, b), swap(u -= t * v, v);
}
return modint(u);
}
modint pow(ll n) const {
assert(n >= 0);
modint ret(1), mul(val);
while (n > 0) {
if (n & 1) ret *= mul;
mul *= mul;
n >>= 1;
}
return ret;
}
static constexpr int get_mod() { return mod; }
// (n, r), r は 1 の 2^n 乗根
static constexpr pair<int, int> ntt_info() {
if (mod == 120586241) return {20, 74066978};
if (mod == 167772161) return {25, 17};
if (mod == 469762049) return {26, 30};
if (mod == 754974721) return {24, 362};
if (mod == 880803841) return {23, 211};
if (mod == 943718401) return {22, 663003469};
if (mod == 998244353) return {23, 31};
if (mod == 1004535809) return {21, 836905998};
if (mod == 1045430273) return {20, 363};
if (mod == 1051721729) return {20, 330};
if (mod == 1053818881) return {20, 2789};
return {-1, -1};
}
static constexpr bool can_ntt() { return ntt_info().fi != -1; }
};
#ifdef FASTIO
template <int mod>
void rd(modint<mod> &x) {
fastio::rd(x.val);
x.val %= mod;
// assert(0 <= x.val && x.val < mod);
}
template <int mod>
void wt(modint<mod> x) {
fastio::wt(x.val);
}
#endif
using modint107 = modint<1000000007>;
using modint998 = modint<998244353>;
#line 5 "main.cpp"
using mint = modint998;
void solve() {
LL(N);
VEC(ll, A, N);
ll S = SUM<ll>(A);
if (S & 1) return print(0);
S /= 2;
vv(mint, dp, N + 1, S + 1);
dp[0][0] = 1;
for (auto& x: A) {
FOR_R(i, N) FOR(j, S + 1) {
if (j + x <= S) dp[i + 1][j + x] += dp[i][j];
}
}
mint ANS = 0;
FOR(n, N + 1) {
mint ans = dp[n][S];
ans *= fact<mint>(n);
ans *= fact<mint>(N - n);
ANS += ans;
}
print(ANS);
}
signed main() {
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3628kb
input:
3 4 9 5
output:
4
result:
ok "4"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
2 100 100
output:
2
result:
ok "2"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
8 3 2 6 3 1 2 4 5
output:
11520
result:
ok "11520"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2 93 93
output:
2
result:
ok "2"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
2 62 45
output:
0
result:
ok "0"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
3 32 68 36
output:
4
result:
ok "4"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
3 27 2 25
output:
4
result:
ok "4"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3712kb
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: 3656kb
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: 3944kb
input:
9 57 19 88 13 55 43 27 10 74
output:
5760
result:
ok "5760"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3636kb
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: 3912kb
input:
10 56 72 93 39 70 78 3 10 84 48
output:
0
result:
ok "0"
Test #13:
score: 0
Accepted
time: 1ms
memory: 3904kb
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: 3688kb
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: 3624kb
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: 3500kb
input:
10 26 5 25 35 77 46 81 13 73 32
output:
0
result:
ok "0"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
10 37 43 7 51 89 86 84 26 28 15
output:
103680
result:
ok "103680"
Test #18:
score: 0
Accepted
time: 5ms
memory: 3864kb
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: 3664kb
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: 3912kb
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: 3728kb
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: 3944kb
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: 7ms
memory: 3840kb
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: 3ms
memory: 3896kb
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: 5ms
memory: 4072kb
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: 3688kb
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: 16ms
memory: 4184kb
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: 1ms
memory: 3980kb
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: 1ms
memory: 4012kb
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: 1ms
memory: 3732kb
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: 1ms
memory: 3728kb
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: 1ms
memory: 3784kb
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: 1ms
memory: 3988kb
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: 19ms
memory: 4276kb
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: 19ms
memory: 4144kb
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: 23ms
memory: 4056kb
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: 3628kb
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: 3628kb
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: 3628kb
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: 3560kb
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: 22ms
memory: 4448kb
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: 17ms
memory: 4116kb
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: 20ms
memory: 4336kb
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: 3984kb
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: 17ms
memory: 3940kb
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: 17ms
memory: 4276kb
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: 15ms
memory: 3924kb
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: 17ms
memory: 4244kb
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: 39ms
memory: 5260kb
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: 19ms
memory: 4144kb
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: 0ms
memory: 3504kb
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: 37ms
memory: 5232kb
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: 37ms
memory: 5340kb
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