QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#205650 | #7561. Digit DP | ucup-team1469# | AC ✓ | 209ms | 33260kb | C++20 | 21.9kb | 2023-10-07 16:54:51 | 2023-10-07 16:55:00 |
Judging History
answer
#line 1 "main.cpp"
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tag_and_trait.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// namespace gt = __gnu_pbds;
#define IS_MULTITEST 0
#line 1 "/Library/atcoder/lazysegtree.hpp"
#line 8 "/Library/atcoder/lazysegtree.hpp"
#line 1 "/Library/atcoder/internal_bit.hpp"
#ifdef _MSC_VER
#include <intrin.h>
#endif
#if __cplusplus >= 202002L
#include <bit>
#endif
namespace atcoder {
namespace internal {
#if __cplusplus >= 202002L
using std::bit_ceil;
#else
// @return same with std::bit::bit_ceil
unsigned int bit_ceil(unsigned int n) {
unsigned int x = 1;
while (x < (unsigned int)(n)) x *= 2;
return x;
}
#endif
// @param n `1 <= n`
// @return same with std::bit::countr_zero
int countr_zero(unsigned int n) {
#ifdef _MSC_VER
unsigned long index;
_BitScanForward(&index, n);
return index;
#else
return __builtin_ctz(n);
#endif
}
// @param n `1 <= n`
// @return same with std::bit::countr_zero
constexpr int countr_zero_constexpr(unsigned int n) {
int x = 0;
while (!(n & (1 << x))) x++;
return x;
}
} // namespace internal
} // namespace atcoder
#line 10 "/Library/atcoder/lazysegtree.hpp"
namespace atcoder {
#if __cplusplus >= 201703L
template <class S,
auto op,
auto e,
class F,
auto mapping,
auto composition,
auto id>
struct lazy_segtree {
static_assert(std::is_convertible_v<decltype(op), std::function<S(S, S)>>,
"op must work as S(S, S)");
static_assert(std::is_convertible_v<decltype(e), std::function<S()>>,
"e must work as S()");
static_assert(
std::is_convertible_v<decltype(mapping), std::function<S(F, S)>>,
"mapping must work as F(F, S)");
static_assert(
std::is_convertible_v<decltype(composition), std::function<F(F, F)>>,
"compostiion must work as F(F, F)");
static_assert(std::is_convertible_v<decltype(id), std::function<F()>>,
"id must work as F()");
#else
template <class S,
S (*op)(S, S),
S (*e)(),
class F,
S (*mapping)(F, S),
F (*composition)(F, F),
F (*id)()>
struct lazy_segtree {
#endif
public:
lazy_segtree() : lazy_segtree(0) {}
explicit lazy_segtree(int n) : lazy_segtree(std::vector<S>(n, e())) {}
explicit lazy_segtree(const std::vector<S>& v) : _n(int(v.size())) {
size = (int)internal::bit_ceil((unsigned int)(_n));
log = internal::countr_zero((unsigned int)size);
d = std::vector<S>(2 * size, e());
lz = std::vector<F>(size, id());
for (int i = 0; i < _n; i++) d[size + i] = v[i];
for (int i = size - 1; i >= 1; i--) {
update(i);
}
}
void set(int p, S x) {
assert(0 <= p && p < _n);
p += size;
for (int i = log; i >= 1; i--) push(p >> i);
d[p] = x;
for (int i = 1; i <= log; i++) update(p >> i);
}
S get(int p) {
assert(0 <= p && p < _n);
p += size;
for (int i = log; i >= 1; i--) push(p >> i);
return d[p];
}
S prod(int l, int r) {
assert(0 <= l && l <= r && r <= _n);
if (l == r) return e();
l += size;
r += size;
for (int i = log; i >= 1; i--) {
if (((l >> i) << i) != l) push(l >> i);
if (((r >> i) << i) != r) push((r - 1) >> i);
}
S sml = e(), smr = e();
while (l < r) {
if (l & 1) sml = op(sml, d[l++]);
if (r & 1) smr = op(d[--r], smr);
l >>= 1;
r >>= 1;
}
return op(sml, smr);
}
S all_prod() { return d[1]; }
void apply(int p, F f) {
assert(0 <= p && p < _n);
p += size;
for (int i = log; i >= 1; i--) push(p >> i);
d[p] = mapping(f, d[p]);
for (int i = 1; i <= log; i++) update(p >> i);
}
void apply(int l, int r, F f) {
assert(0 <= l && l <= r && r <= _n);
if (l == r) return;
l += size;
r += size;
for (int i = log; i >= 1; i--) {
if (((l >> i) << i) != l) push(l >> i);
if (((r >> i) << i) != r) push((r - 1) >> i);
}
{
int l2 = l, r2 = r;
while (l < r) {
if (l & 1) all_apply(l++, f);
if (r & 1) all_apply(--r, f);
l >>= 1;
r >>= 1;
}
l = l2;
r = r2;
}
for (int i = 1; i <= log; i++) {
if (((l >> i) << i) != l) update(l >> i);
if (((r >> i) << i) != r) update((r - 1) >> i);
}
}
template <bool (*g)(S)> int max_right(int l) {
return max_right(l, [](S x) { return g(x); });
}
template <class G> int max_right(int l, G g) {
assert(0 <= l && l <= _n);
assert(g(e()));
if (l == _n) return _n;
l += size;
for (int i = log; i >= 1; i--) push(l >> i);
S sm = e();
do {
while (l % 2 == 0) l >>= 1;
if (!g(op(sm, d[l]))) {
while (l < size) {
push(l);
l = (2 * l);
if (g(op(sm, d[l]))) {
sm = op(sm, d[l]);
l++;
}
}
return l - size;
}
sm = op(sm, d[l]);
l++;
} while ((l & -l) != l);
return _n;
}
template <bool (*g)(S)> int min_left(int r) {
return min_left(r, [](S x) { return g(x); });
}
template <class G> int min_left(int r, G g) {
assert(0 <= r && r <= _n);
assert(g(e()));
if (r == 0) return 0;
r += size;
for (int i = log; i >= 1; i--) push((r - 1) >> i);
S sm = e();
do {
r--;
while (r > 1 && (r % 2)) r >>= 1;
if (!g(op(d[r], sm))) {
while (r < size) {
push(r);
r = (2 * r + 1);
if (g(op(d[r], sm))) {
sm = op(d[r], sm);
r--;
}
}
return r + 1 - size;
}
sm = op(d[r], sm);
} while ((r & -r) != r);
return 0;
}
private:
int _n, size, log;
std::vector<S> d;
std::vector<F> lz;
void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }
void all_apply(int k, F f) {
d[k] = mapping(f, d[k]);
if (k < size) lz[k] = composition(f, lz[k]);
}
void push(int k) {
all_apply(2 * k, lz[k]);
all_apply(2 * k + 1, lz[k]);
lz[k] = id();
}
};
} // namespace atcoder
#line 1 "/Library/atcoder/math.hpp"
#line 8 "/Library/atcoder/math.hpp"
#line 1 "/Library/atcoder/internal_math.hpp"
#line 5 "/Library/atcoder/internal_math.hpp"
#ifdef _MSC_VER
#include <intrin.h>
#endif
namespace atcoder {
namespace internal {
// @param m `1 <= m`
// @return x mod m
constexpr long long safe_mod(long long x, long long m) {
x %= m;
if (x < 0) x += m;
return x;
}
// Fast modular multiplication by barrett reduction
// Reference: https://en.wikipedia.org/wiki/Barrett_reduction
// NOTE: reconsider after Ice Lake
struct barrett {
unsigned int _m;
unsigned long long im;
// @param m `1 <= m`
explicit barrett(unsigned int m) : _m(m), im((unsigned long long)(-1) / m + 1) {}
// @return m
unsigned int umod() const { return _m; }
// @param a `0 <= a < m`
// @param b `0 <= b < m`
// @return `a * b % m`
unsigned int mul(unsigned int a, unsigned int b) const {
// [1] m = 1
// a = b = im = 0, so okay
// [2] m >= 2
// im = ceil(2^64 / m)
// -> im * m = 2^64 + r (0 <= r < m)
// let z = a*b = c*m + d (0 <= c, d < m)
// a*b * im = (c*m + d) * im = c*(im*m) + d*im = c*2^64 + c*r + d*im
// c*r + d*im < m * m + m * im < m * m + 2^64 + m <= 2^64 + m * (m + 1) < 2^64 * 2
// ((ab * im) >> 64) == c or c + 1
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 long long y = x * _m;
return (unsigned int)(z - y + (z < y ? _m : 0));
}
};
// @param n `0 <= n`
// @param m `1 <= m`
// @return `(x ** n) % m`
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;
}
// Reference:
// M. Forisek and J. Jancina,
// Fast Primality Testing for Integers That Fit into a Machine Word
// @param n `0 <= n`
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;
constexpr long long bases[3] = {2, 7, 61};
for (long long a : bases) {
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);
// @param b `1 <= b`
// @return pair(g, x) s.t. g = gcd(a, b), xa = g (mod b), 0 <= x < b/g
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};
// Contracts:
// [1] s - m0 * a = 0 (mod b)
// [2] t - m1 * a = 0 (mod b)
// [3] s * |m1| + t * |m0| <= b
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
// [3]:
// (s - t * u) * |m1| + t * |m0 - m1 * u|
// <= s * |m1| - t * u * |m1| + t * (|m0| + |m1| * u)
// = s * |m1| + t * |m0| <= b
auto tmp = s;
s = t;
t = tmp;
tmp = m0;
m0 = m1;
m1 = tmp;
}
// by [3]: |m0| <= b/g
// by g != b: |m0| < b/g
if (m0 < 0) m0 += b / s;
return {s, m0};
}
// Compile time primitive root
// @param m must be prime
// @return primitive root (and minimum in now)
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);
// @param n `n < 2^32`
// @param m `1 <= m < 2^32`
// @return sum_{i=0}^{n-1} floor((ai + b) / m) (mod 2^64)
unsigned long long floor_sum_unsigned(unsigned long long n,
unsigned long long m,
unsigned long long a,
unsigned long long b) {
unsigned long long ans = 0;
while (true) {
if (a >= m) {
ans += n * (n - 1) / 2 * (a / m);
a %= m;
}
if (b >= m) {
ans += n * (b / m);
b %= m;
}
unsigned long long y_max = a * n + b;
if (y_max < m) break;
// y_max < m * (n + 1)
// floor(y_max / m) <= n
n = (unsigned long long)(y_max / m);
b = (unsigned long long)(y_max % m);
std::swap(m, a);
}
return ans;
}
} // namespace internal
} // namespace atcoder
#line 10 "/Library/atcoder/math.hpp"
namespace atcoder {
long long pow_mod(long long x, long long n, int m) {
assert(0 <= n && 1 <= m);
if (m == 1) return 0;
internal::barrett bt((unsigned int)(m));
unsigned int r = 1, y = (unsigned int)(internal::safe_mod(x, m));
while (n) {
if (n & 1) r = bt.mul(r, y);
y = bt.mul(y, y);
n >>= 1;
}
return r;
}
long long inv_mod(long long x, long long m) {
assert(1 <= m);
auto z = internal::inv_gcd(x, m);
assert(z.first == 1);
return z.second;
}
// (rem, mod)
std::pair<long long, long long> crt(const std::vector<long long>& r,
const std::vector<long long>& m) {
assert(r.size() == m.size());
int n = int(r.size());
// Contracts: 0 <= r0 < m0
long long r0 = 0, m0 = 1;
for (int i = 0; i < n; i++) {
assert(1 <= m[i]);
long long r1 = internal::safe_mod(r[i], m[i]), m1 = m[i];
if (m0 < m1) {
std::swap(r0, r1);
std::swap(m0, m1);
}
if (m0 % m1 == 0) {
if (r0 % m1 != r1) return {0, 0};
continue;
}
// assume: m0 > m1, lcm(m0, m1) >= 2 * max(m0, m1)
// (r0, m0), (r1, m1) -> (r2, m2 = lcm(m0, m1));
// r2 % m0 = r0
// r2 % m1 = r1
// -> (r0 + x*m0) % m1 = r1
// -> x*u0*g = r1-r0 (mod u1*g) (u0*g = m0, u1*g = m1)
// -> x = (r1 - r0) / g * inv(u0) (mod u1)
// im = inv(u0) (mod u1) (0 <= im < u1)
long long g, im;
std::tie(g, im) = internal::inv_gcd(m0, m1);
long long u1 = (m1 / g);
// |r1 - r0| < (m0 + m1) <= lcm(m0, m1)
if ((r1 - r0) % g) return {0, 0};
// u1 * u1 <= m1 * m1 / g / g <= m0 * m1 / g = lcm(m0, m1)
long long x = (r1 - r0) / g % u1 * im % u1;
// |r0| + |m0 * x|
// < m0 + m0 * (u1 - 1)
// = m0 + m0 * m1 / g - m0
// = lcm(m0, m1)
r0 += x * m0;
m0 *= u1; // -> lcm(m0, m1)
if (r0 < 0) r0 += m0;
}
return {r0, m0};
}
long long floor_sum(long long n, long long m, long long a, long long b) {
assert(0 <= n && n < (1LL << 32));
assert(1 <= m && m < (1LL << 32));
unsigned long long ans = 0;
if (a < 0) {
unsigned long long a2 = internal::safe_mod(a, m);
ans -= 1ULL * n * (n - 1) / 2 * ((a2 - a) / m);
a = a2;
}
if (b < 0) {
unsigned long long b2 = internal::safe_mod(b, m);
ans -= 1ULL * n * ((b2 - b) / m);
b = b2;
}
return ans + internal::floor_sum_unsigned(n, m, a, b);
}
} // namespace atcoder
#line 10 "main.cpp"
using namespace std;
// #include "angel/math/modint.hpp"
#pragma region Macros
// clang-format off
using ll = long long; using uint = unsigned int; using ull = unsigned long long;
using i32 = int; using i64 = ll; using u32 = uint; using u64 = ull;
template <class T> using Vec = vector<T>;
template <class T> using RevPriq = priority_queue<T, vector<T>, greater<T>>;
constexpr int inf32 = 1 << 30; constexpr ll inf64 = 1ll << 60;
constexpr char eoln = '\n';
#define L(i, l, r) for (int i = l; i < r; ++i)
#define R(i, l, r) for (int i = r - 1; i >= l; --i)
#define ALL(x) (x).begin(), (x).end()
#define mem(a, x) memset(a, x, sizeof(a))
#define sz(a) (int)((a).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
// clang-format on
#pragma endregion
// Coding Space
// vars
constexpr ll MaxN = 105, MaxQ = 50010, mod = 998244353;
int N, Q;
ll dp[MaxN][2][4];
ll A[MaxN];
string L[MaxQ], R[MaxQ];
Vec<string> hs;
int Ty[MaxQ];
ll X[MaxQ];
// funcs
using T = array<ll, 4>;
T op(const T &a, const T &b) {
T ret;
L(i, 0, 4) {
ret[i] = a[i] + b[i];
if (ret[i] >= mod) ret[i] -= mod;
}
return ret;
}
T e() {
T ret;
fill(ALL(ret), 0);
return ret;
}
using U = ll;
U composite(U a, U b) {
return a + b;
}
T mapping(U a, const T &x) {
T ret;
fill(ALL(ret), 0);
ret[0] = x[0];
ret[1] += x[1];
ret[1] += x[0] * a;
ret[2] += x[2];
ret[2] += 2 * x[1] * a % mod;
ret[2] += x[0] * a % mod * a;
ret[3] += x[3];
ret[3] += 3 * x[2] * a % mod;
ret[3] += 3 * x[1] * a % mod * a % mod;
ret[3] += x[0] * a % mod * a % mod * a % mod;
for (auto &e : ret) e %= mod;
return ret;
}
U id() {
return 0;
}
string inc(string x) {
if (all_of(ALL(x), [](char v) { return v == '1'; })) {
string t(x.size() + 1, '0');
t[0] = '1';
return t;
} else {
R(i, 0, sz(x)) {
if (x[i] == '0') {
x[i] = '1';
L(j, i + 1, sz(x)) x[j] = '0';
break;
}
}
return x;
}
}
string dec(string x) {
R(i, 0, sz(x)) {
if (x[i] == '1') {
x[i] = '0';
L(j, i + 1, sz(x)) x[j] = '1';
break;
}
}
return x;
}
void main_() {
cin >> N >> Q;
L(i, 0, N) cin >> A[i];
L(i, 0, Q) {
cin >> Ty[i];
if (Ty[i] == 1) {
cin >> L[i] >> R[i];
hs.pb(inc(R[i]));
hs.pb(L[i]);
cin >> X[i];
} else {
cin >> L[i] >> R[i];
hs.pb(inc(R[i]));
hs.pb(L[i]);
}
}
hs.pb(string(N, '0'));
{
string a(N + 1, '0');
a[0] = '1';
hs.pb(a);
}
auto comp = [](const string &a, const string &b) {
if (sz(a) != sz(b)) {
return sz(a) < sz(b);
}
else {
L(i, 0, sz(a)) if (a[i] != b[i]) {
return a[i] < b[i];
}
return false;
}
};
sort(ALL(hs), comp);
hs.erase(unique(ALL(hs)), hs.end());
const int M = (int)hs.size();
auto calc = [&](string &u) {
mem(dp, 0ll);
if (sz(u) == N) dp[0][1][0] = 1;
else dp[0][0][0] = 1;
L(i, 0, N) {
L(j, 0, 2) {
L(k, 0, 4) {
// next : 0
{
int nx = (j == 1 and u[i] == '0') ? 1 : 0;
// dp[i][nx]
dp[i + 1][nx][k] += dp[i][j][k];
dp[i + 1][nx][k] %= mod;
}
// next : 1
{
if (j == 1 and u[i] == '0') continue;
int nx = j;
i64 a = A[N - i - 1];
if (k == 0) {
dp[i + 1][nx][k] += dp[i][j][0];
} else if (k == 1) {
dp[i + 1][nx][k] += dp[i][j][1];
dp[i + 1][nx][k] += a * dp[i][j][0];
} else if (k == 2) {
dp[i + 1][nx][k] += dp[i][j][2];
dp[i + 1][nx][k] += 2 * a * dp[i][j][1] % mod;
dp[i + 1][nx][k] += dp[i][j][0] * a % mod * a % mod;
} else if (k == 3) {
dp[i + 1][nx][k] += dp[i][j][3];
dp[i + 1][nx][k] += 3 * dp[i][j][2] * a;
dp[i + 1][nx][k] += 3 * dp[i][j][1] % mod * a % mod * a % mod;
dp[i + 1][nx][k] += dp[i][j][0] * a % mod * a % mod * a % mod;
}
dp[i + 1][nx][k] %= mod;
}
}
}
}
array<i64, 4> ret;
fill(ALL(ret), 0);
L(i, 0, 2) L(j, 0, 4) ret[j] += dp[N][i][j];
for (auto &e : ret) e %= mod;
return ret;
};
vector<T> cs(M);
L(i, 1, M) {
string bf = dec(hs[i]);
if (sz(bf) == N + 1) bf.erase(bf.begin());
const auto nc = calc(bf);
L(j, 0, 4) cs[i - 1][j] = nc[j];
}
R(i, 1, M - 1) {
L(j, 0, 4) {
cs[i][j] -= cs[i - 1][j];
if (cs[i][j] < 0) cs[i][j] += mod;
}
}
atcoder::lazy_segtree<T, op, e, U, mapping, composite, id> seg(cs);
auto calcAns = [&](int l, int r) {
const auto pr = seg.prod(l, r);
ll res = pr[1] * pr[1] % mod * pr[1] % mod;
res -= pr[3];
res -= 3 * (pr[2] * pr[1] - pr[3]);
res %= mod;
if (res < 0) res += mod;
res *= atcoder::inv_mod(6, mod);
res %= mod;
return res;
};
L(i, 0, Q) {
int l = lower_bound(ALL(hs), L[i], comp) - hs.begin();
int r = lower_bound(ALL(hs), inc(R[i]), comp) - hs.begin();
if (Ty[i] == 1) seg.apply(l, r, X[i]);
else cout << calcAns(l, r) << endl;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
if constexpr (IS_MULTITEST == 0) {
main_();
} else {
// multitest (cf-style)
int T;
cin >> T;
while (T--) {
main_();
cout << flush;
}
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 6652kb
input:
3 3 1 2 4 2 000 111 1 010 101 1 2 000 111
output:
1960 3040
result:
ok 2 number(s): "1960 3040"
Test #2:
score: 0
Accepted
time: 0ms
memory: 6720kb
input:
2 2 1 1 2 00 10 2 00 11
output:
0 2
result:
ok 2 number(s): "0 2"
Test #3:
score: 0
Accepted
time: 173ms
memory: 32156kb
input:
99 49952 470888 74578 802746 396295 386884 721198 628655 722503 207868 647942 87506 792718 761498 917727 843338 908043 952768 268783 375312 414369 319712 96230 277106 168102 263554 936674 246545 667941 198849 268921 191459 436316 134606 802932 515506 837311 465964 394766 17626 650419 984050 790137 4...
output:
413449847 513027341 379532803 828185770 758023792 955841012 501590435 193833160 52015005 225646848 79278417 702315659 500712121 309545833 425668668 376205546 751940860 216608361 71293362 894788412 240680508 127400767 584610664 427310971 447134022 992309654 109125715 611523032 601028580 647705121 222...
result:
ok 24939 numbers
Test #4:
score: 0
Accepted
time: 140ms
memory: 32140kb
input:
99 49996 475634 928248 927808 875072 158867 937890 595515 26685 468307 240390 887597 586447 764525 365644 156469 188306 350786 308832 695957 562147 427221 937909 590963 478310 357775 361535 993561 967811 718075 555000 533750 412453 936715 173340 350235 67386 20497 895277 233727 235830 182535 324591 ...
output:
259953307 262069796 924406695 26478563 298108385 704809872 792095151 692313907 142605670 903738194 553847857 38647574 43984176 29033158 867129569 773316503 446446137 689917105 416630991 420951134 458731790 810982529 271786324 784672540 32086643 884115047 362416513 759279937 954942112 657139797 84271...
result:
ok 24966 numbers
Test #5:
score: 0
Accepted
time: 169ms
memory: 32140kb
input:
97 49937 288891 590429 244358 321145 930851 89174 529670 363571 728747 543238 720391 188689 702144 813561 628383 660056 781508 605777 759705 485733 534730 812292 937524 788519 451996 10588 483682 267682 461493 65270 619145 355885 963015 800644 217669 264757 640439 685387 674020 853944 91420 891750 5...
output:
965092014 894220805 25147419 773946359 121175554 920857234 690801029 201407028 945021685 635573900 216040077 104774110 355850561 561273301 926775110 372974907 597614504 942178785 379372329 754110414 735461091 710022471 323330013 717895783 482511705 946821704 625188740 299932888 895004295 367564320 5...
result:
ok 25768 numbers
Test #6:
score: 0
Accepted
time: 209ms
memory: 33260kb
input:
96 49981 102149 219907 593611 24114 959730 305867 496529 635050 21890 102981 487777 982418 896659 518374 876106 907614 179526 645826 856158 633510 642240 653971 475573 98727 513513 435449 165290 567552 980720 351348 994140 332021 797828 138348 52399 751728 227676 475498 922825 215163 289905 426204 7...
output:
274224174 634217068 813069780 582646554 692811965 500277373 820650745 249911179 910599837 79752646 454211240 542480599 531528915 576664734 417008251 248368338 924557955 675037065 933004411 320044817 134377085 177982136 923478201 167853704 738499226 732464690 723323846 661464097 823371891 129173478 1...
result:
ok 24458 numbers
Test #7:
score: 0
Accepted
time: 140ms
memory: 31964kb
input:
99 49921 106895 882089 718673 502890 699009 489855 430685 939232 282330 630021 287868 584659 866982 966291 348020 379364 642952 942770 919906 781288 492853 752547 789430 217447 607734 893014 655411 867422 467242 828915 303728 275454 599937 732948 887129 981803 814914 8713 363118 833277 488390 960658...
output:
571914589 935084376 827788412 707727385 222848822 789988142 130081973 890052791 21823459 198217451 775618413 943091375 261240034 711259481 243909220 167600347 186737627 526251657 226935286 979557550 784330590 857111244 108590275 746670632 67900274 551981921 855980494 246942307 634439271 823459341 35...
result:
ok 24928 numbers
Test #8:
score: 0
Accepted
time: 186ms
memory: 32700kb
input:
99 49970 887448 703054 67926 981667 695184 641139 364840 276118 318577 222469 896470 378388 28793 414208 595743 659626 40970 207011 207847 704874 600362 594226 168695 527655 701955 509363 369723 134588 210660 147697 613315 251590 434750 103356 721858 179173 402151 798823 546514 451392 654171 752009 ...
output:
994539861 230160518 831071911 658104212 646333204 48758132 438924579 479652249 500155431 388305435 61288261 662022245 836922136 428322715 754372301 55811268 812913663 248594306 932725310 243841330 342441725 888780076 877471721 958979518 295016896 997768920 253078043 484841714 578699274 988896609 841...
result:
ok 24970 numbers
Test #9:
score: 0
Accepted
time: 164ms
memory: 32324kb
input:
97 49922 924898 332532 192988 684636 499872 857831 331700 547597 579017 525316 696560 204822 31820 862125 908873 131377 438988 312468 271596 852652 740575 501313 482552 837864 796176 934224 84035 210267 729886 657968 731414 195022 461051 697957 589292 409248 989389 523526 19511 812610 595760 286463 ...
output:
670642273 100974501 625973766 105095407 972918641 230643745 884360909 863808877 784806784 361515233 226518536 681307050 91526349 382996995 458256474 766680719 175217744 990501348 775220693 121647158 443490504 964608278 366850818 295051421 82689337 499548119 737432899 477101352 878525064 366413071 84...
result:
ok 25732 numbers
Test #10:
score: 0
Accepted
time: 179ms
memory: 32628kb
input:
100 49963 705451 994713 509537 130709 463343 41819 265855 851779 839457 85060 496650 774359 193631 310042 380788 411639 869710 576709 368048 33133 623893 375696 796409 923880 114590 391789 574156 510137 249112 135534 41001 171159 263159 35661 391318 639323 576627 89445 235612 430725 794245 820918 89...
output:
915810899 506294427 47800009 103639896 956906949 548330581 732270643 752575162 498382746 898706792 533368210 715772880 170169296 821669776 366622196 930058524 422553215 727535836 456033290 178329746 702822832 431557772 991450571 994720884 841765419 749599756 642382643 578076375 621922898 29723350 43...
result:
ok 25238 numbers
Test #11:
score: 0
Accepted
time: 157ms
memory: 32632kb
input:
99 49907 710197 624191 858791 609486 268030 225807 200011 188665 132600 612100 329445 633496 196658 757959 628510 883389 267729 840950 655989 180911 731402 217375 142970 299496 208811 8138 288468 810007 992530 421612 383292 81887 97972 662965 258752 836694 196568 846851 675905 791943 960026 388076 5...
output:
26550913 37967518 866129092 449447729 784627573 957609030 223734858 109702716 706620813 908609246 200088075 65731593 746451302 791934803 545413883 279170991 984659992 16766707 572424663 67271436 659220473 679665329 511747582 303939869 586840465 557851982 314773019 661277669 671563584 157595593 66252...
result:
ok 24947 numbers
Test #12:
score: 0
Accepted
time: 190ms
memory: 32744kb
input:
98 49918 274071 359971 550121 204862 843967 173607 619138 690754 219513 171337 183499 549873 542337 661387 397647 495917 413076 918417 868000 422012 195703 305826 526356 334728 535984 133227 226371 632864 493387 611196 258251 576565 244054 713672 267148 679390 700005 67050 546349 2772 999375 951131 ...
output:
64412198 438330476 544087922 183377287 218050658 63409640 622983373 792175595 56162202 109909817 597953619 475435831 503222938 971092944 703746139 370972476 721890059 256607366 980618411 389408168 185601217 807652101 254330391 642979159 235228431 627504981 383641079 760270951 463228607 300744777 826...
result:
ok 25130 numbers