QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#888293 | #9785. Shrooks | fxhd | AC ✓ | 295ms | 16724kb | C++14 | 18.0kb | 2025-02-08 07:44:09 | 2025-02-08 07:44:09 |
Judging History
answer
#include <bits/stdc++.h>
#include <cassert>
#include <numeric>
#include <type_traits>
#ifdef _MSC_VER
#include <intrin.h>
#endif
#include <utility>
#ifdef _MSC_VER
#include <intrin.h>
#endif
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;
explicit 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 long long y = x * _m;
return (unsigned int)(z - y + (z < y ? _m : 0));
}
};
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;
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);
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);
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;
n = (unsigned long long)(y_max / m);
b = (unsigned long long)(y_max % m);
std::swap(m, a);
}
return ans;
}
} // namespace internal
} // namespace atcoder
#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
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());
}
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());
}
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 namespace std;
#ifdef DEBUG
#include "debug.hpp"
#else
#define dbg(...) 0
#endif
using mint = atcoder::modint998244353;
int solve(const vector<int>& a) {
int n = a.size();
auto calc = [&](int l1, int r1, int l2, int r2) -> mint {
vector<pair<int, int>> lr(n);
vector<vector<int>> by_len(n);
for (int i = 0; i < n; ++i) {
lr[i] = {max(max(l1 - i, i - r2), 0), min(min(r1 - i, i - l2), n - 1)};
if (lr[i].first > lr[i].second) return 0;
by_len[lr[i].second - lr[i].first].push_back(i);
}
mint val = 1;
vector<bool> used(n, 0);
for (int len = 0; (val != 0) && (len < n); ++len) {
if (int k = by_len[len].size(); k > 0) {
assert(k <= 2);
if (k == 1) {
int r = by_len[len][0];
assert(!used[lr[r].first] || !used[lr[r].second]);
if ((lr[r].second > lr[r].first) && !used[lr[r].first] && !used[lr[r].second]) {
if (a[r] >= 0) {
if ((a[r] != lr[r].first) && (a[r] != lr[r].second)) {
val = 0;
}
}
}
else {
int x = (used[lr[r].first]) ? lr[r].second : lr[r].first;
if ((a[r] >= 0) && (a[r] != x)) val = 0;
used[x] = 1;
}
}
else {
int ra = by_len[len][0], rb = by_len[len][1];
assert(lr[ra] == lr[rb]);
if (lr[ra].first == lr[ra].second) {
val = 0;
continue;
}
if (used[lr[ra].first] || used[lr[ra].second]) {
val = 0;
continue;
}
if ((a[ra] >= 0) && (a[ra] != lr[ra].first) && (a[ra] != lr[ra].second)) {
val = 0;
}
if ((a[rb] >= 0) && (a[rb] != lr[rb].first) && (a[rb] != lr[rb].second)) {
val = 0;
}
if ((a[ra] < 0) && (a[rb] < 0)) {
val += val;
}
used[lr[ra].first] = 1;
used[lr[ra].second] = 1;
}
}
}
return val;
};
mint ans = 0;
vector<array<int, 4>> lrs;
for (int l0 = max((n - 3) / 2, 0); l0 <= min(n / 2 + 1, n - 1); ++l0) {
lrs.push_back({l0, l0 + n, -l0 - 2, n - l0 - 2});
lrs.push_back({l0, l0 + n, -l0 - 1, n - l0 - 1});
lrs.push_back({l0, l0 + n, -l0 - 0, n - l0 - 0});
lrs.push_back({l0 - 2, l0 + n - 2, -l0, -l0 + n});
lrs.push_back({l0 - 1, l0 + n - 1, -l0, -l0 + n});
lrs.push_back({l0 - 0, l0 + n - 0, -l0, -l0 + n});
}
sort(lrs.begin(), lrs.end());
lrs.resize(unique(lrs.begin(), lrs.end()) - lrs.begin());
for (const array<int, 4>& lrlr : lrs) {
ans += calc(lrlr[0], lrlr[1], lrlr[2], lrlr[3]);
}
vector<array<int, 4>> isect;
for (int i = 0; i < int(lrs.size()); ++i) {
for (int j = 0; j < i; ++j) {
array<int, 4> cand{max(lrs[i][0], lrs[j][0]), min(lrs[i][1], lrs[j][1]), max(lrs[i][2], lrs[j][2]), min(lrs[i][3], lrs[j][3])};
if (((cand[1] - cand[0]) >= n - 1) && ((cand[3] - cand[2]) >= n - 1)) {
isect.push_back(cand);
}
}
}
sort(isect.begin(), isect.end());
isect.resize(unique(isect.begin(), isect.end()) - isect.begin());
for (const array<int, 4>& lrlr : isect) {
ans -= calc(lrlr[0], lrlr[1], lrlr[2], lrlr[3]);
}
return ans.val();
}
void test_case() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
if (a[i] >= 0) --a[i];
}
cout << solve(a) << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
test_case();
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3712kb
input:
6 2 1 2 3 -1 -1 -1 4 1 -1 -1 -1 5 1 -1 -1 -1 5 6 3 -1 -1 -1 -1 4 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
output:
1 4 1 0 6 92
result:
ok 6 numbers
Test #2:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
6 2 1 2 3 -1 -1 -1 4 1 -1 -1 -1 5 1 -1 -1 -1 5 6 3 -1 -1 -1 -1 4 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
output:
1 4 1 0 6 92
result:
ok 6 numbers
Test #3:
score: 0
Accepted
time: 220ms
memory: 3584kb
input:
26874 7 -1 -1 7 1 5 3 -1 7 -1 -1 5 3 6 -1 7 7 -1 7 -1 2 3 6 -1 7 -1 2 7 1 5 3 -1 7 3 -1 2 6 1 4 -1 7 4 -1 5 6 1 -1 3 7 -1 -1 4 -1 7 2 -1 7 -1 6 -1 5 4 3 -1 7 6 7 1 2 5 4 -1 7 -1 5 -1 4 2 3 6 7 -1 4 3 5 7 6 -1 7 6 -1 -1 -1 7 5 -1 7 -1 -1 2 -1 4 -1 3 7 -1 -1 2 -1 6 -1 4 7 -1 5 6 2 7 4 -1 7 -1 -1 6 -1 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2 0 2 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 2 3 0 0 0 0 0 5 0 0 1 0 0 0 0 0 0 0 0 1 0 0 3 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 1 0 0 0 0 0 0 0 ...
result:
ok 26874 numbers
Test #4:
score: 0
Accepted
time: 220ms
memory: 3584kb
input:
26874 7 3 -1 2 1 5 4 -1 7 3 5 4 -1 1 -1 -1 7 4 -1 3 2 7 5 -1 7 -1 -1 1 7 5 2 -1 7 -1 -1 -1 -1 5 4 3 7 5 -1 2 -1 7 4 -1 7 -1 3 -1 6 7 1 5 7 7 1 5 -1 4 -1 -1 7 5 -1 -1 7 -1 -1 4 7 -1 5 4 7 -1 6 -1 7 6 -1 7 -1 3 -1 5 7 -1 5 6 -1 1 -1 3 7 -1 1 3 2 -1 -1 -1 7 -1 4 2 3 1 -1 5 7 -1 4 1 5 -1 -1 2 7 7 6 4 5 ...
output:
0 0 0 0 0 0 0 0 2 0 0 1 0 0 0 0 0 0 0 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 2 0 0 ...
result:
ok 26874 numbers
Test #5:
score: 0
Accepted
time: 282ms
memory: 3712kb
input:
625 8 -1 -1 -1 -1 -1 -1 -1 -1 9 -1 -1 -1 -1 -1 -1 -1 -1 -1 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 11 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 12 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 13 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 14 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
output:
44 60 92 124 188 252 380 508 764 1020 1532 2044 3068 4092 6140 8188 12284 16380 24572 32764 49148 65532 98300 131068 196604 262140 393212 524284 786428 1048572 1572860 2097148 3145724 4194300 6291452 8388604 12582908 16777212 25165820 33554428 50331644 67108860 100663292 134217724 201326588 26843545...
result:
ok 625 numbers
Test #6:
score: 0
Accepted
time: 262ms
memory: 3840kb
input:
97 2000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
69678827 92905104 139357658 185810212 278715320 371620428 557430644 743240860 116616939 488237371 233233882 976474746 466467768 954705143 932935540 911165937 867626731 824087525 737009113 649930701 475773877 301617053 951547758 603234110 904851167 208223871 811457985 416447746 624671621 832895496 25...
result:
ok 97 numbers
Test #7:
score: 0
Accepted
time: 230ms
memory: 16712kb
input:
1 199999 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
78278419
result:
ok 1 number(s): "78278419"
Test #8:
score: 0
Accepted
time: 291ms
memory: 16696kb
input:
1 200000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
616539807
result:
ok 1 number(s): "616539807"
Test #9:
score: 0
Accepted
time: 238ms
memory: 3584kb
input:
10000 24 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 10 24 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 18 10 8 -1 6 -1 ...
output:
0 12284 0 4092 32 4095 0 128 0 0 764 158 256 2044 764 1 1 0 4095 1020 1022 3068 2 32 16382 16380 318 26 318 1020 1532 128 16 0 24572 2044 4092 4 2 6140 12284 8188 6140 2 508 764 8190 1 1023 1532 510 2044 1 63 380 64 2044 0 6140 3068 8 2044 256 2 32 383 4092 4 3068 0 6140 1532 32 8188 6140 380 6140 4...
result:
ok 10000 numbers
Test #10:
score: 0
Accepted
time: 240ms
memory: 3712kb
input:
10000 13 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 21 -1 -1 -1 7 6 -1 -1 -1 2 -1 -1 1 19 -1 -1 16 15 14 -1 -1 -1 16 -1 -1 -1 -1 13 3 15 1 16 2 14 4 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
252 3068 32 16 254 4092 1532 0 188 4092 1020 2044 8188 1 64 2 380 158 16380 0 191 8 0 0 1020 8191 131070 6140 32 510 256 0 0 12284 6140 4092 4 2047 128 128 1 7166 16 2 6140 0 8 1024 2044 8188 4 2558 0 128 2 1 8188 764 6140 1 0 128 30 49148 62 0 12284 508 127 638 16 1 380 0 4095 8 0 32 1 4095 256 4 4...
result:
ok 10000 numbers
Test #11:
score: 0
Accepted
time: 238ms
memory: 3712kb
input:
10000 19 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 19 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 22 -1 -1 14 15 -1 6 -1 -1 -1 -1 22 1 -1 3 4 5 -1 -1 8 -1 -1 -1 27 -1 -1 -1 -1 -1 -1 -1 -1 22 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20 -1 -1 -1 -1 -1 -1 -1 -1 ...
output:
2044 2044 16 8191 3068 2046 512 1020 16383 65534 4094 4092 1023 1 508 2 4092 16 6140 764 6140 639 0 1023 0 0 3068 8190 6140 128 60 0 128 2 508 2046 0 8 4092 64 1 32 6140 190 2 0 764 0 6140 16 8 0 8188 32 0 0 512 764 0 32 8 1 0 2044 0 2047 4092 32766 764 1 1022 128 8191 0 32 24572 128 0 32 764 49148 ...
result:
ok 10000 numbers
Test #12:
score: 0
Accepted
time: 237ms
memory: 3584kb
input:
10000 24 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 23 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 25 12 11 10 -1 -1 19 -1 5 4 3 2 1 25 24 -1 22 -1 20 7 8 17 -1 15 14 -1 26 -1 -1 -1 -...
output:
12284 3068 8188 1 24572 255 6140 24572 32764 2 1 3068 511 32 4092 255 0 393212 512 380 254 3068 1020 638 0 0 2044 256 64 524284 128 64 8 4094 1020 2044 32 254 8188 382 766 1020 128 1 0 1024 4 6140 2044 12284 3068 4092 16380 1020 38 8 0 64 393212 4094 49148 508 8188 2048 38 767 512 6140 128 1 2 64 32...
result:
ok 10000 numbers
Test #13:
score: 0
Accepted
time: 241ms
memory: 3712kb
input:
10000 25 -1 -1 -1 17 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 24 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 17 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
output:
3071 1532 254 12284 1020 764 256 0 6140 511 0 0 2 12287 3068 0 64 4 32 8188 32764 0 1022 62 764 0 3068 0 2044 1023 128 508 252 32 64 319 1 8 0 64 252 16380 8188 48 32 24572 1532 4 3068 16 1020 0 0 188 4 2046 124 2047 126 131068 1023 4092 1532 2047 4 0 0 95 2047 1024 382 6140 0 1 64 6140 6140 16380 0...
result:
ok 10000 numbers
Test #14:
score: 0
Accepted
time: 251ms
memory: 3840kb
input:
10000 15 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 10 -1 25 -1 -1 -1 -1 -1 -1 -1 -1 23 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 25 -1 -1 -1 -1 -1 -1 -1 5 -1 -1 -1 -1 25 -1 -1 -...
output:
508 3068 128 0 1024 6140 0 32 262140 128 4092 6140 252 0 1532 3068 0 124 0 16 3068 16380 158 4 1532 0 1020 1532 0 2 1020 0 0 318 127 32 8190 126 0 1 0 0 508 3068 4092 0 12284 65532 764 0 4092 0 0 1532 4096 1023 6140 1 188 128 4094 256 64 79 1532 512 2047 638 0 128 6140 1023 382 764 64 32 0 8188 256 ...
result:
ok 10000 numbers
Test #15:
score: 0
Accepted
time: 240ms
memory: 3712kb
input:
10000 17 -1 -1 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 19 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 16 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 16 -1 -1 -1 -1 -1 11 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 17 -1 8 11 -1 13 4 -1 -1 1 17 16 3 -1 -1 6 -1 10 16 -1 10 11 5 -1 -1 -1 1 16 2 1...
output:
0 2044 64 0 1 1 8188 0 1532 6140 188 32 0 0 508 766 1024 4092 0 64 3068 1020 3068 0 764 188 32768 0 2 318 0 0 8 1020 764 8188 4092 1 0 638 1020 1532 2044 158 8191 6140 3068 0 3068 511 188 0 1022 0 6140 32 0 32767 8 511 508 319 4 190 1 32766 2 0 2 0 128 63 2048 380 1023 32764 54 128 2044 0 188 511 20...
result:
ok 10000 numbers
Test #16:
score: 0
Accepted
time: 237ms
memory: 3712kb
input:
10000 22 12 10 -1 -1 -1 -1 -1 -1 3 2 -1 -1 21 20 -1 -1 -1 -1 8 14 13 11 25 -1 11 10 -1 -1 18 19 -1 -1 -1 2 -1 -1 1 23 22 4 -1 6 -1 -1 -1 15 -1 12 18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 14 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 15 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 16 -1 ...
output:
32 8 128 32 508 64 3068 1020 0 0 16380 1024 511 510 2046 127 2048 4096 0 6140 64 2046 12284 764 2046 3068 32 16 1 8188 508 1023 4092 252 47 8 0 16380 2 0 16380 1020 511 64 512 766 31 0 0 0 256 764 0 64 8188 2 16383 0 8 1024 1023 256 0 8188 1020 4 188 508 4092 0 64 1023 2558 1020 3068 380 0 128 0 153...
result:
ok 10000 numbers
Test #17:
score: 0
Accepted
time: 239ms
memory: 3584kb
input:
10000 22 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 18 9 -1 -1 6 14 15 3 -1 -1 18 -1 16 4 -1 13 7 8 10 20 10 9 -1 7 15 5 17 18 19 -1 20 -1 -1 4 16 6 14 13 12 11 20 -1 -1 -1 -1 -1 -1 18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 22 11 -1 -1 -1 -1 6 -1 -1 -1 21 1 -1 -1 -1 -1 -1 -1 1...
output:
6140 2 1 256 16 0 508 380 0 0 1020 16380 32 0 764 64 2046 512 131068 1022 0 0 4096 188 383 256 2047 65532 64 318 256 6140 1020 0 2044 24572 1 4095 128 0 764 8190 32 4 0 64 65532 1022 0 24572 254 8 3068 0 8192 3068 2 1023 6140 256 32 64 1532 2047 8 255 766 1532 128 32 3068 0 49148 8 2047 32 16380 163...
result:
ok 10000 numbers
Test #18:
score: 0
Accepted
time: 238ms
memory: 3840kb
input:
10000 18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 9 -1 -1 17 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 13 -1 -1 -1 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 28 14 -1 12 -1 10 -1 -1 -1 23 -1 4 3 27 -1 1 2 26 25 5 6 -1 -1 20 19 -1 17 -1 15 26 -1...
output:
0 1020 1532 0 16 24572 1022 0 1023 764 8 32 0 64 3068 0 1 2048 4092 1532 508 255 32764 1020 512 4095 2 0 1532 16 0 3068 3068 128 1023 1532 764 2047 2047 64 764 511 4 2047 2 256 764 254 16 31 1 3068 4095 64 1532 8 3068 4 16 4 4 126 2047 1020 4 6140 6140 1 2044 126 0 256 128 6140 1023 1 158 0 0 0 6140...
result:
ok 10000 numbers
Test #19:
score: 0
Accepted
time: 250ms
memory: 3968kb
input:
100 1996 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
687744635 196839516 755489666 69678827 951547758 266201546 185810214 371620428 976474749 476174913 801889856 230806092 159566486 0 0 0 279868367 875030000 149467963 930820825 784037796 510735315 49696824 0 461612191 70796466 672579723 0 506334863 159566489 230806092 379887494 608503959 88733846 1175...
result:
ok 100 numbers
Test #20:
score: 0
Accepted
time: 256ms
memory: 3712kb
input:
100 1938 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
output:
0 371620432 911165941 976474750 970972875 601722871 0 196839516 454654153 379887494 349151410 266247384 57701524 28850761 603234113 0 557430644 228803765 133490394 98419756 0 79783245 427011595 416447750 83501095 687744631 0 911243614 687744635 862346803 637113048 189943748 133490394 0 617122664 615...
result:
ok 100 numbers
Test #21:
score: 0
Accepted
time: 248ms
memory: 3712kb
input:
100 2066 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
834862697 23226273 278715320 116616939 601315941 884598617 0 3765090 556575133 301617053 0 230806092 436222071 1882545 759774995 759774995 923224380 25059058 758831532 371620428 233233882 0 673697878 266247384 446368374 363466540 436222071 759774995 754489833 185810215 44366921 0 266247384 687744634...
result:
ok 100 numbers
Test #22:
score: 0
Accepted
time: 252ms
memory: 3712kb
input:
100 1972 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
141418137 120595093 731696071 603234110 811457985 689435486 427011599 0 0 770952885 324744552 0 196839516 0 687744631 0 523142607 635424006 375929777 537692343 0 23226277 133123690 455621807 500292333 668008760 754489833 0 875054260 44366921 773184442 240965760 0 0 929481727 0 6151231 77140333 69816...
result:
ok 100 numbers
Test #23:
score: 0
Accepted
time: 249ms
memory: 3584kb
input:
100 2047 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
output:
0 386592219 46452550 141418137 743240864 0 0 848204411 182583049 940453896 621987768 667546643 466025955 272277747 0 14425380 0 266247384 278287563 268906116 569831243 689435486 624671621 562027925 0 842994493 358616606 817223464 0 444595123 731696071 0 156102147 45813225 0 904851167 0 479292266 954...
result:
ok 100 numbers
Test #24:
score: 0
Accepted
time: 254ms
memory: 3840kb
input:
100 2008 1004 1003 1002 1001 -1 1010 -1 -1 996 -1 -1 1016 992 991 990 -1 988 1022 986 1024 1025 983 1027 981 980 979 978 1032 976 975 1035 973 972 -1 1039 969 -1 -1 966 -1 964 963 1047 -1 960 959 -1 -1 956 1054 1055 -1 1057 1058 -1 1060 1061 947 -1 1064 944 -1 1067 -1 1069 1070 1071 -1 -1 1074 -1 -1...
output:
608858250 421497243 988759971 796722578 450247064 371620431 875687385 603234112 869067658 79639131 371620428 233233882 24604936 442978742 44366925 86552282 832895496 0 43276139 398084597 933360445 817550116 867626731 709870796 466467768 603234112 784037796 0 0 196009446 768629076 823522459 638265956...
result:
ok 100 numbers
Test #25:
score: 0
Accepted
time: 254ms
memory: 3840kb
input:
100 1955 -1 -1 -1 982 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1051 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 893 -1 -1 890 -1 -1 -1 -1 -1 -1 1...
output:
663616721 723193849 676115973 0 976474746 69678827 796169198 827018326 931277135 840250283 649930705 69678827 548124535 228803765 230806094 527847872 32375512 799780147 772454936 92905104 576471803 0 0 49777186 642586216 208223871 0 398361287 556575134 993502162 371620428 12723609 759774992 0 532403...
result:
ok 100 numbers
Test #26:
score: 0
Accepted
time: 251ms
memory: 3840kb
input:
100 2079 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
output:
0 772454932 0 133490394 115403048 613524059 569831243 796722581 23226273 0 12302466 698164477 379887496 98419756 976474746 752289608 88733846 709870796 643710771 745182733 0 310458197 421497246 875687385 699747052 0 759774992 906455299 484916460 502197790 0 393679036 743240863 0 0 130397105 30161705...
result:
ok 100 numbers
Test #27:
score: 0
Accepted
time: 251ms
memory: 3712kb
input:
100 2014 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
932935540 0 687744631 16187756 23226277 951547758 0 398084597 0 951547758 539063199 208223871 336848941 637113048 879190462 534470978 46452553 461612188 0 820977562 356313984 233233882 698164473 919247316 651336739 49209876 177467696 133123690 334010009 24604936 346209140 823626258 832895496 7432408...
result:
ok 100 numbers
Test #28:
score: 0
Accepted
time: 250ms
memory: 3840kb
input:
100 2084 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
201119824 848204411 954705146 185810215 23226276 559736730 848204411 0 421497246 608341720 0 718919792 398361287 260380120 239349731 768629075 114905915 349151411 92905104 630377599 336848940 288586625 0 23226273 540872724 286928079 96081722 336848937 210709411 773184442 0 837180163 50279953 9846086...
result:
ok 100 numbers
Test #29:
score: 0
Accepted
time: 260ms
memory: 16680kb
input:
1 199916 99959 99960 99961 99962 99954 99964 99965 -1 99950 -1 -1 -1 -1 99945 99973 99974 -1 99976 -1 -1 99979 99937 -1 -1 -1 99933 -1 -1 99987 -1 -1 -1 99991 99925 -1 -1 99995 -1 99997 99919 -1 -1 99916 -1 -1 -1 -1 99911 100007 100008 99908 -1 -1 99905 99904 99903 -1 100016 -1 100018 -1 -1 -1 99895...
output:
173961957
result:
ok 1 number(s): "173961957"
Test #30:
score: 0
Accepted
time: 223ms
memory: 16492kb
input:
1 199961 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
output:
0
result:
ok 1 number(s): "0"
Test #31:
score: 0
Accepted
time: 235ms
memory: 16448kb
input:
1 199957 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
672756062
result:
ok 1 number(s): "672756062"
Test #32:
score: 0
Accepted
time: 252ms
memory: 16672kb
input:
1 199906 -1 99955 -1 99957 99958 99948 -1 99946 99962 -1 -1 99965 -1 99967 99939 -1 -1 99971 99972 -1 99933 -1 -1 -1 99929 99928 99980 99981 -1 99983 -1 -1 99921 99920 99919 -1 99990 -1 99992 99914 99994 99912 99911 -1 99998 -1 99907 -1 -1 -1 99903 -1 -1 99900 -1 -1 -1 100011 -1 100013 100014 99892 ...
output:
634868560
result:
ok 1 number(s): "634868560"
Test #33:
score: 0
Accepted
time: 282ms
memory: 16428kb
input:
1 199954 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
501844609
result:
ok 1 number(s): "501844609"
Test #34:
score: 0
Accepted
time: 288ms
memory: 16648kb
input:
1 199922 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
458110054
result:
ok 1 number(s): "458110054"
Test #35:
score: 0
Accepted
time: 255ms
memory: 16464kb
input:
1 199964 99983 -1 99985 99979 99987 99988 -1 -1 -1 99973 -1 99994 99995 99969 99997 -1 -1 100000 99964 -1 99962 -1 99960 99959 -1 99957 -1 -1 99954 99953 -1 99951 -1 100016 -1 -1 -1 -1 -1 100022 100023 -1 -1 -1 99938 -1 100029 99935 99934 99933 -1 -1 -1 -1 99928 99927 100039 100040 99924 99923 -1 -1...
output:
444173461
result:
ok 1 number(s): "444173461"
Test #36:
score: 0
Accepted
time: 265ms
memory: 16724kb
input:
1 199932 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
556130586
result:
ok 1 number(s): "556130586"
Test #37:
score: 0
Accepted
time: 198ms
memory: 16488kb
input:
1 199991 -1 99994 99993 99992 -1 99990 -1 -1 -1 -1 -1 99984 -1 -1 100011 99980 100013 -1 100015 -1 99975 -1 99973 -1 99971 99970 -1 -1 -1 -1 -1 -1 -1 99962 -1 100032 -1 -1 100035 -1 -1 99954 -1 -1 99951 100042 99949 99948 -1 100046 100047 -1 -1 -1 -1 -1 100053 -1 -1 -1 -1 -1 99933 -1 -1 -1 100063 -1...
output:
779998139
result:
ok 1 number(s): "779998139"
Test #38:
score: 0
Accepted
time: 295ms
memory: 16528kb
input:
1 199992 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
849607271
result:
ok 1 number(s): "849607271"
Test #39:
score: 0
Accepted
time: 265ms
memory: 16588kb
input:
1 199980 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
527524180
result:
ok 1 number(s): "527524180"
Test #40:
score: 0
Accepted
time: 262ms
memory: 16564kb
input:
1 199926 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
output:
0
result:
ok 1 number(s): "0"
Test #41:
score: 0
Accepted
time: 205ms
memory: 16700kb
input:
1 199957 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
667311192
result:
ok 1 number(s): "667311192"
Test #42:
score: 0
Accepted
time: 228ms
memory: 16440kb
input:
1 199947 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
956877704
result:
ok 1 number(s): "956877704"
Test #43:
score: 0
Accepted
time: 231ms
memory: 16636kb
input:
1 199935 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
826024747
result:
ok 1 number(s): "826024747"
Test #44:
score: 0
Accepted
time: 257ms
memory: 16632kb
input:
1 199980 99991 -1 99988 99994 -1 -1 -1 99983 99982 100000 99980 -1 -1 100004 100005 99975 99974 -1 -1 99971 100011 99969 -1 -1 -1 100016 -1 -1 100019 99961 -1 -1 99958 100024 -1 99955 100027 99953 -1 -1 -1 99949 -1 99947 -1 -1 100037 -1 99942 100040 -1 99939 99938 99937 100045 -1 -1 -1 99932 -1 -1 -...
output:
177136763
result:
ok 1 number(s): "177136763"
Test #45:
score: 0
Accepted
time: 254ms
memory: 16668kb
input:
1 199962 -1 99980 -1 -1 99977 -1 99975 99989 99990 99972 99992 99970 99994 -1 99996 99997 99965 -1 100000 99962 -1 99960 -1 -1 100006 99956 100008 99954 99953 100011 100012 99950 -1 99948 -1 -1 99945 -1 -1 -1 99941 100023 99939 99938 100026 100027 99935 99934 100030 99932 99931 99930 100034 100035 9...
output:
465650177
result:
ok 1 number(s): "465650177"
Test #46:
score: 0
Accepted
time: 232ms
memory: 16420kb
input:
1 199965 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
781653522
result:
ok 1 number(s): "781653522"
Test #47:
score: 0
Accepted
time: 244ms
memory: 16672kb
input:
1 199986 -1 99995 99996 99990 99998 -1 -1 -1 99985 -1 -1 100005 100006 100007 99979 -1 100010 -1 99975 99974 99973 -1 -1 100017 -1 99968 100020 100021 99965 -1 99963 100025 99961 99960 -1 99958 100030 100031 -1 100033 -1 -1 100036 99950 99949 -1 100040 99946 99945 100043 99943 99942 100046 100047 -1...
output:
53217606
result:
ok 1 number(s): "53217606"
Test #48:
score: 0
Accepted
time: 260ms
memory: 16628kb
input:
1 199948 99975 -1 -1 -1 -1 99980 -1 -1 99983 -1 -1 99963 -1 99961 -1 99959 -1 99957 -1 -1 -1 -1 99997 -1 -1 -1 -1 -1 100003 -1 -1 100006 -1 -1 -1 100010 -1 -1 -1 -1 -1 99933 -1 99931 -1 99929 -1 99927 -1 99925 -1 100026 99922 -1 -1 -1 -1 -1 100033 100034 -1 -1 -1 99911 -1 99909 -1 99907 -1 -1 -1 100...
output:
644437797
result:
ok 1 number(s): "644437797"
Extra Test:
score: 0
Extra Test Passed