QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#444015 | #8527. Power Divisions | ucup-team987# | TL | 3195ms | 73396kb | C++20 | 18.4kb | 2024-06-15 17:04:30 | 2024-06-15 17:04:32 |
Judging History
answer
#include<iostream>
#include<tuple>
#include<vector>
#include<cassert>
#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 int v = (unsigned int)(z - x * _m);
if (_m <= v) v += _m;
return v;
}
};
constexpr long long pow_mod_constexpr(long long x, long long n, int m) {
if (m == 1) return 0;
unsigned int _m = (unsigned int)(m);
unsigned long long r = 1;
unsigned long long y = safe_mod(x, m);
while (n) {
if (n & 1) r = (r * y) % _m;
y = (y * y) % _m;
n >>= 1;
}
return r;
}
constexpr bool is_prime_constexpr(int n) {
if (n <= 1) return false;
if (n == 2 || n == 7 || n == 61) return true;
if (n % 2 == 0) return false;
long long d = n - 1;
while (d % 2 == 0) d /= 2;
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
#include <cassert>
#include <vector>
namespace atcoder {
template <class T> struct fenwick_tree {
using U = internal::to_unsigned_t<T>;
public:
fenwick_tree() : _n(0) {}
explicit fenwick_tree(int n) : _n(n), data(n) {}
void add(int p, T x) {
assert(0 <= p && p < _n);
p++;
while (p <= _n) {
data[p - 1] += U(x);
p += p & -p;
}
}
T sum(int l, int r) {
assert(0 <= l && l <= r && r <= _n);
return sum(r) - sum(l);
}
private:
int _n;
std::vector<U> data;
U sum(int r) {
U s = 0;
while (r > 0) {
s += data[r - 1];
r -= r & -r;
}
return s;
}
};
} // namespace atcoder
using namespace std;
using mint=atcoder::modint1000000007;
const int LEN=1000;
int N,A[3<<17];
vector<int>Ai[1<<20];
vector<int>G[3<<17];
mint dp[3<<17];
int TM,Sum[1<<20],sumvis[1<<20],vis[3<<17];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N;
for(int i=0;i<N;i++)
{
cin>>A[i];
Ai[A[i]].push_back(i);
}
vector<vector<tuple<int,int,int> > >now,nxt;
now.emplace_back();
now.back().emplace_back(0,N+1,0);
long long sum=0;
atcoder::fenwick_tree<int>BIT(N);
atcoder::fenwick_tree<int>BIT_up(N);
for(int i=0;i<N;i++)BIT_up.add(i,1);
for(int k=0;!now.empty()&&k<1<<20;k++)
{
if(sum==0&&Ai[k].empty())continue;
nxt.clear();
for(int idx:Ai[k])
{
BIT.add(idx,1);
BIT_up.add(idx,-1);
}
long long nxtsum=0;
for(int i=0;i<now.size();i++)
{
vector<tuple<int,int,int> >T0,T1;
for(auto[l,r,add]:now[i])
{
add+=BIT.sum(0,l);
auto it=lower_bound(Ai[k].begin(),Ai[k].end(),l);
int nl=l;
while(true)
{
int nr=it==Ai[k].end()?r:min(*it+1,r);
if(nl<nr)
{
if(add%2==0)
{
T0.emplace_back(nl,nr,add/2);
nxtsum+=add/2;
if(!T1.empty()&&get<2>(T1.back())+1==add/2)
{
int from=get<1>(T1.back())-1;
int to=nl;
if(BIT_up.sum(from,to)==0)G[from].push_back(to);
}
}
else
{
T1.emplace_back(nl,nr,add/2);
nxtsum+=add/2;
if(!T0.empty()&&get<2>(T0.back())==add/2)
{
int from=get<1>(T0.back())-1;
int to=nl;
if(BIT_up.sum(from,to)==0)G[from].push_back(to);
}
}
}
nl=nr;
if(nr==r)break;
it++;
add++;
}
}
if(!T0.empty())
{
int l=get<0>(T0[0]);
int r=get<1>(T0.back());
//cout<<l<<", "<<r<<endl;
if(r-l>=LEN)
{
int len=0;
for(auto[l,r,add]:T0)len+=r-l;
if(len>=2)nxt.push_back(T0);
}
}
if(!T1.empty())
{
int l=get<0>(T1[0]);
int r=get<1>(T1.back());
//cout<<l<<", "<<r<<endl;
if(r-l>=LEN)
{
int len=0;
for(auto[l,r,add]:T1)len+=r-l;
if(len>=2)nxt.push_back(T1);
}
}
}
for(int idx:Ai[k])BIT.add(idx,-1);
now.swap(nxt);
sum=nxtsum;
}
dp[0]=1;
for(int i=0;i<N;i++)
{
TM++;
for(int j:G[i])
{
dp[j]+=dp[i];
vis[j]=TM;
}
int pc=0;
for(int j=i;j<i+LEN+10;j++)
{
int a=A[j];
while(true)
{
if(sumvis[a]<TM)sumvis[a]=TM,Sum[a]=0;
if(Sum[a]==0)
{
Sum[a]=1;
pc++;
break;
}
else
{
Sum[a]=0;
pc--;
a++;
}
}
if(pc==1&&vis[j+1]<TM)dp[j+1]+=dp[i];
}
}
cout<<dp[N].val()<<endl;
return 0;
for(int i=0;i<=N;i++)dp[i]=0;
dp[0]=1;
for(int i=0;i<N;i++)
{
for(int k=0;k<100;k++)Sum[k]=0;
int pc=0;
for(int j=i;j<N;j++)
{
int a=A[j];
while(true)
{
if(Sum[a]==0)
{
Sum[a]=1;
pc++;
break;
}
else
{
Sum[a]=0;
pc--;
a++;
}
}
if(pc==1)dp[j+1]+=dp[i];
}
}
cout<<dp[N].val()<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 5172kb
input:
5 2 0 0 1 1
output:
6
result:
ok 1 number(s): "6"
Test #2:
score: 0
Accepted
time: 2ms
memory: 5164kb
input:
1 0
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 5400kb
input:
2 1 1
output:
2
result:
ok 1 number(s): "2"
Test #4:
score: 0
Accepted
time: 0ms
memory: 5180kb
input:
3 2 1 1
output:
3
result:
ok 1 number(s): "3"
Test #5:
score: 0
Accepted
time: 2ms
memory: 5088kb
input:
4 3 2 2 3
output:
4
result:
ok 1 number(s): "4"
Test #6:
score: 0
Accepted
time: 3ms
memory: 5348kb
input:
5 3 4 4 2 4
output:
2
result:
ok 1 number(s): "2"
Test #7:
score: 0
Accepted
time: 3ms
memory: 5148kb
input:
7 3 4 3 5 6 3 4
output:
6
result:
ok 1 number(s): "6"
Test #8:
score: 0
Accepted
time: 3ms
memory: 5100kb
input:
10 8 6 5 6 7 8 6 8 9 9
output:
4
result:
ok 1 number(s): "4"
Test #9:
score: 0
Accepted
time: 0ms
memory: 5088kb
input:
96 5 1 0 2 5 5 2 4 2 4 4 2 3 4 0 2 1 4 3 1 2 0 2 2 3 2 4 5 3 5 2 0 2 2 5 3 0 4 5 3 5 4 4 3 1 2 0 5 4 5 0 2 3 2 4 0 0 4 2 0 2 5 3 3 1 5 5 1 1 1 0 5 0 3 0 2 1 1 0 5 0 3 3 4 4 5 3 0 2 2 0 5 4 5 0 5
output:
11332014
result:
ok 1 number(s): "11332014"
Test #10:
score: 0
Accepted
time: 5ms
memory: 5108kb
input:
480 2 0 4 4 1 0 0 3 1 1 4 2 5 5 4 2 1 2 4 4 1 3 4 3 0 5 2 0 2 5 1 0 5 0 0 5 5 0 2 5 2 2 3 1 4 3 5 4 5 2 4 4 4 4 1 4 0 3 4 3 4 1 0 4 3 4 5 4 3 5 0 2 2 0 1 5 4 4 2 0 3 3 3 4 3 0 5 5 3 1 5 1 0 1 0 4 3 0 5 1 4 1 4 3 0 1 3 5 0 3 3 1 0 4 1 1 2 0 1 2 0 3 5 2 0 5 5 5 5 3 5 1 0 2 5 2 2 0 2 0 2 3 5 1 2 1 5 4 ...
output:
506782981
result:
ok 1 number(s): "506782981"
Test #11:
score: 0
Accepted
time: 23ms
memory: 5752kb
input:
2400 0 2 2 0 5 4 3 2 3 2 5 4 5 4 4 5 2 2 4 2 2 0 1 0 5 0 4 4 0 0 5 0 4 0 1 3 4 5 0 3 1 0 4 0 2 5 0 3 3 3 3 1 0 5 5 3 1 3 5 2 4 0 5 0 4 5 4 2 2 1 5 2 2 4 1 0 5 1 5 0 1 2 0 0 3 5 4 0 0 1 1 1 4 2 0 5 1 3 3 5 0 4 4 1 5 5 3 4 4 4 0 2 4 0 5 1 3 1 5 0 5 5 1 3 0 3 1 2 0 1 1 3 5 2 3 4 0 3 0 5 4 0 4 3 5 0 5 2...
output:
586570528
result:
ok 1 number(s): "586570528"
Test #12:
score: 0
Accepted
time: 118ms
memory: 6640kb
input:
12000 2 2 1 2 0 2 5 3 2 0 1 3 2 5 4 0 0 5 3 2 0 2 3 4 3 2 1 4 3 0 3 5 4 1 0 2 4 1 3 2 3 5 0 3 0 0 4 0 4 5 1 0 4 1 1 1 5 4 3 0 3 5 4 5 2 5 0 1 2 3 5 5 2 5 4 2 0 4 4 3 0 0 2 5 0 3 4 2 5 4 2 1 4 5 1 1 2 3 0 3 3 3 3 4 0 5 3 4 0 3 0 2 0 0 2 0 3 4 2 2 0 1 0 5 3 0 2 0 2 2 1 0 5 3 5 4 5 5 0 4 0 4 1 4 4 3 2 ...
output:
201653965
result:
ok 1 number(s): "201653965"
Test #13:
score: 0
Accepted
time: 606ms
memory: 12080kb
input:
60000 2 5 0 3 2 3 5 3 5 5 4 1 1 5 3 0 1 1 2 5 5 5 0 3 2 0 3 2 3 3 0 0 1 4 3 1 4 2 3 3 0 5 1 0 1 1 5 5 4 0 5 4 1 3 1 3 5 3 2 4 4 4 5 4 3 2 3 2 4 5 2 0 4 5 1 2 0 4 0 5 1 3 4 1 2 4 1 1 3 3 0 1 1 3 0 0 2 3 3 2 1 4 1 2 4 3 3 5 2 5 3 4 3 0 2 1 1 1 5 1 2 4 2 3 1 2 1 0 2 0 1 1 5 5 3 4 2 5 2 4 5 3 0 5 1 4 2 ...
output:
592751350
result:
ok 1 number(s): "592751350"
Test #14:
score: 0
Accepted
time: 3195ms
memory: 40300kb
input:
300000 0 5 1 5 5 4 5 3 0 5 0 5 1 4 1 2 2 2 3 0 1 5 4 0 3 1 4 5 2 1 0 3 2 1 2 5 0 2 4 5 0 1 2 1 1 0 0 5 3 0 0 3 4 5 0 2 1 1 1 2 5 1 4 3 1 0 2 0 0 4 3 3 2 5 3 3 1 5 2 0 2 4 3 1 0 3 4 1 3 3 1 0 0 1 1 1 3 1 2 3 5 3 3 2 0 3 0 0 5 5 0 0 0 0 1 4 3 3 4 3 4 5 3 3 5 1 1 4 2 2 1 3 2 1 1 0 0 5 5 0 0 3 2 4 5 5 2...
output:
842503795
result:
ok 1 number(s): "842503795"
Test #15:
score: 0
Accepted
time: 1155ms
memory: 73396kb
input:
300000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
432100269
result:
ok 1 number(s): "432100269"
Test #16:
score: 0
Accepted
time: 1155ms
memory: 73388kb
input:
300000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...
output:
432100269
result:
ok 1 number(s): "432100269"
Test #17:
score: 0
Accepted
time: 2742ms
memory: 59540kb
input:
299995 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 1 0 1 1 1 0 0 1 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0 0 1 0 1 1 0 1 1 1 1 0 1 1 1 1 0 0 0 0 0 1 0 1 1 0 0 0 1 0 0 1 1 0 0 1 1 1 1 1 1 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 0 0...
output:
261818019
result:
ok 1 number(s): "261818019"
Test #18:
score: 0
Accepted
time: 3192ms
memory: 39924kb
input:
299997 2 2 0 9 4 4 2 3 8 9 3 9 1 6 4 0 1 5 1 0 7 9 3 3 8 9 3 8 3 6 9 3 9 5 9 1 4 4 7 5 9 0 7 3 7 2 0 3 3 8 2 1 7 6 8 1 6 1 8 4 7 6 3 6 1 6 8 9 3 8 1 5 0 8 1 10 0 3 4 5 8 5 6 9 2 4 5 0 9 0 9 5 1 0 3 7 5 8 8 10 10 3 3 10 5 8 9 9 7 4 4 1 1 6 5 7 2 5 8 3 3 9 6 4 1 0 2 6 2 8 7 7 10 5 7 8 3 8 5 1 6 6 6 1 ...
output:
999738318
result:
ok 1 number(s): "999738318"
Test #19:
score: 0
Accepted
time: 2041ms
memory: 21448kb
input:
299999 97 34 33 30 15 73 31 69 60 63 79 87 78 13 49 58 23 38 91 28 70 70 14 98 56 59 81 66 29 21 10 51 94 32 41 98 16 48 67 62 55 5 17 81 30 91 39 93 73 74 46 74 41 99 19 10 0 16 72 95 84 40 97 17 76 10 42 50 66 97 4 30 71 74 46 5 75 87 55 82 38 94 14 82 49 10 23 21 19 99 52 100 71 29 64 73 54 88 2 ...
output:
799664563
result:
ok 1 number(s): "799664563"
Test #20:
score: 0
Accepted
time: 570ms
memory: 18260kb
input:
299997 97 181 693 569 34 770 725 1 82 951 965 962 962 532 803 824 669 686 529 339 434 430 439 478 553 354 443 632 725 139 56 709 797 847 617 100 837 94 80 527 644 861 8 455 710 599 473 818 685 886 645 722 239 634 450 16 825 337 156 708 827 790 462 716 67 557 535 466 820 465 567 140 633 112 85 691 16...
output:
152812109
result:
ok 1 number(s): "152812109"
Test #21:
score: 0
Accepted
time: 535ms
memory: 14268kb
input:
300000 7938 3542 362 8246 5914 9327 9031 9802 6879 5983 1052 8554 8571 187 3412 4806 1991 9465 7940 8741 5792 7136 6654 7716 2896 4212 3357 6278 3398 5631 4759 6295 7385 5487 699 3015 422 4849 4933 3169 3194 7014 7605 9619 8126 4673 5020 842 9477 2925 857 1263 3326 729 4638 3383 7716 887 7821 2009 7...
output:
294967268
result:
ok 1 number(s): "294967268"
Test #22:
score: 0
Accepted
time: 859ms
memory: 18372kb
input:
300000 68003 20603 19535 98755 78166 31928 28492 76831 77102 95079 32154 12348 91482 11514 67510 4208 30189 31364 77353 60045 60124 58954 32468 38599 70247 18763 32984 76656 86646 79971 63986 68195 33578 90458 79520 92707 17642 7744 26043 12273 28374 63264 97058 36502 6212 70591 51401 76682 41512 18...
output:
32
result:
ok 1 number(s): "32"
Test #23:
score: 0
Accepted
time: 955ms
memory: 51144kb
input:
299995 704135 597658 946639 146393 887400 976091 33440 872707 692148 819088 785763 285388 604527 830260 851525 558807 997790 380755 251183 328941 129356 741341 530638 817968 603319 899844 731899 356842 867124 825330 645685 373685 70290 726706 995759 161401 398693 132928 535725 831104 643517 149954 7...
output:
1
result:
ok 1 number(s): "1"
Test #24:
score: 0
Accepted
time: 2519ms
memory: 38448kb
input:
300000 999990 999988 999987 999987 999989 999988 999987 999987 999988 999988 999988 999988 999987 999987 999987 999987 999989 999989 999988 999988 999987 999987 999987 999987 999991 999989 999987 999987 999988 999988 999986 999986 999986 999986 999986 999986 999987 999987 999987 999985 999985 999985...
output:
907456874
result:
ok 1 number(s): "907456874"
Test #25:
score: 0
Accepted
time: 395ms
memory: 44852kb
input:
299998 1000000 999998 999997 999994 999993 999992 999990 999987 999986 999985 999984 999983 999981 999977 999976 999975 999974 999971 999969 999968 999966 999964 999963 999961 999960 999955 999953 999947 999946 999945 999944 999943 999940 999937 999936 999935 999934 999933 999930 999928 999927 99992...
output:
299998
result:
ok 1 number(s): "299998"
Test #26:
score: 0
Accepted
time: 534ms
memory: 38664kb
input:
300000 225118 225117 225116 225114 225114 225112 225111 225110 225108 225108 225105 225105 225105 225103 225103 225099 225099 225095 225094 225093 225091 225091 225091 225089 225089 225089 225088 225086 225086 225086 225084 225083 225081 225080 225077 225075 225075 225074 225073 225072 225071 225068...
output:
651536657
result:
ok 1 number(s): "651536657"
Test #27:
score: 0
Accepted
time: 678ms
memory: 33444kb
input:
300000 966603 966600 966600 966599 966596 966591 966588 966586 966586 966585 966583 966581 966580 966577 966577 966578 966578 966577 966576 966576 966581 966580 966580 966583 966583 966586 966589 966590 966592 966593 966592 966590 966588 966587 966585 966584 966581 966580 966578 966577 966577 966573...
output:
956228402
result:
ok 1 number(s): "956228402"
Test #28:
score: 0
Accepted
time: 741ms
memory: 30892kb
input:
300000 318513 318509 318504 318503 318499 318498 318496 318496 318490 318490 318487 318486 318482 318480 318480 318479 318478 318477 318477 318480 318483 318482 318479 318479 318478 318478 318475 318474 318472 318471 318470 318469 318467 318465 318461 318459 318457 318456 318450 318450 318450 318448...
output:
505865071
result:
ok 1 number(s): "505865071"
Test #29:
score: 0
Accepted
time: 887ms
memory: 29268kb
input:
299999 814266 814266 814265 814263 814262 814262 814264 814266 814265 814263 814263 814259 814258 814256 814256 814253 814251 814251 814249 814249 814248 814247 814246 814245 814244 814243 814243 814249 814250 814247 814247 814247 814241 814239 814236 814229 814229 814230 814229 814226 814226 814225...
output:
586808369
result:
ok 1 number(s): "586808369"
Test #30:
score: 0
Accepted
time: 1025ms
memory: 28684kb
input:
299997 999997 999994 999993 999993 999995 999993 999992 999989 999989 999990 999991 999994 999992 999992 999992 999990 999986 999984 999984 999982 999981 999978 999978 999979 999980 999982 999981 999981 999982 999982 999983 999986 999982 999981 999981 999983 999984 999985 999986 999986 999987 999989...
output:
215177543
result:
ok 1 number(s): "215177543"
Test #31:
score: 0
Accepted
time: 1205ms
memory: 28552kb
input:
300000 999997 999995 999995 999996 999997 999996 999996 999994 999994 999995 999995 999991 999990 999989 999988 999988 999992 999992 999991 999988 999987 999987 999985 999985 999986 999987 999987 999987 999990 999994 999994 999992 999992 999993 999995 999995 999992 999992 999993 999994 999993 999993...
output:
777454227
result:
ok 1 number(s): "777454227"
Test #32:
score: 0
Accepted
time: 1467ms
memory: 29156kb
input:
299996 999994 999992 999990 999986 999984 999983 999983 999984 999984 999983 999982 999981 999981 999984 999982 999981 999981 999983 999982 999980 999980 999981 999983 999982 999979 999979 999980 999981 999983 999984 999985 999986 999986 999987 999986 999986 999983 999983 999984 999985 999986 999988...
output:
682333830
result:
ok 1 number(s): "682333830"
Test #33:
score: 0
Accepted
time: 2601ms
memory: 36300kb
input:
300000 39 38 38 36 35 35 32 32 33 29 29 28 28 28 27 24 24 25 25 25 28 26 20 20 19 19 20 21 19 19 18 18 19 23 23 23 24 22 22 22 22 26 26 22 22 22 22 23 23 24 24 26 25 24 23 23 24 24 24 24 28 25 24 24 26 27 28 29 25 25 26 27 28 28 28 30 30 26 24 24 22 22 22 22 24 27 28 28 24 22 20 17 17 18 19 21 23 25...
output:
794828803
result:
ok 1 number(s): "794828803"
Test #34:
score: 0
Accepted
time: 1111ms
memory: 68976kb
input:
299996 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700 679700...
output:
253642571
result:
ok 1 number(s): "253642571"
Test #35:
score: 0
Accepted
time: 1137ms
memory: 63148kb
input:
300000 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015 341015...
output:
871111475
result:
ok 1 number(s): "871111475"
Test #36:
score: 0
Accepted
time: 1100ms
memory: 57924kb
input:
299998 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696 47696...
output:
216182855
result:
ok 1 number(s): "216182855"
Test #37:
score: 0
Accepted
time: 1147ms
memory: 56148kb
input:
300000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...
output:
647909995
result:
ok 1 number(s): "647909995"
Test #38:
score: 0
Accepted
time: 1141ms
memory: 53852kb
input:
300000 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995 999995...
output:
891450574
result:
ok 1 number(s): "891450574"
Test #39:
score: 0
Accepted
time: 1165ms
memory: 53500kb
input:
300000 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997 999997...
output:
10337043
result:
ok 1 number(s): "10337043"
Test #40:
score: 0
Accepted
time: 1234ms
memory: 50044kb
input:
299999 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 16 16...
output:
106078597
result:
ok 1 number(s): "106078597"
Test #41:
score: 0
Accepted
time: 1579ms
memory: 43548kb
input:
300000 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925682 925682 925682 925682 925682 925682 925682 925682 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681 925681...
output:
722322244
result:
ok 1 number(s): "722322244"
Test #42:
score: 0
Accepted
time: 2226ms
memory: 39836kb
input:
299997 862127 862126 862126 862126 862126 862125 862125 862125 862125 862125 862125 862124 862124 862124 862124 862125 862125 862126 862125 862125 862123 862123 862123 862123 862123 862123 862124 862123 862123 862123 862123 862123 862123 862123 862123 862124 862124 862123 862123 862123 862123 862125...
output:
721299215
result:
ok 1 number(s): "721299215"
Test #43:
score: 0
Accepted
time: 469ms
memory: 37244kb
input:
299995 51927 51926 51925 51923 51922 51918 51917 51916 51913 51910 51909 51906 51904 51903 51902 51901 51900 51895 51888 51887 51883 51882 51880 51878 51875 51872 51870 51869 51865 51864 51862 51861 51859 51853 51852 51846 51845 51844 51842 51839 51838 51836 51832 51830 51825 51821 51820 51819 51818...
output:
66848417
result:
ok 1 number(s): "66848417"
Test #44:
score: 0
Accepted
time: 577ms
memory: 39928kb
input:
299995 150532 150531 150528 150527 150525 150524 150522 150519 150516 150514 150513 150509 150508 150507 150506 150502 150501 150500 150499 150498 150494 150492 150491 150490 150488 150487 150486 150484 150482 150480 150479 150478 150476 150475 150471 150466 150463 150461 150460 150459 150458 150457...
output:
385634475
result:
ok 1 number(s): "385634475"
Test #45:
score: 0
Accepted
time: 541ms
memory: 35900kb
input:
299995 240071 240069 240067 240066 240065 240064 240062 240061 240060 240056 240053 240052 240049 240045 240044 240042 240040 240039 240038 240037 240036 240034 240032 240028 240025 240024 240022 240018 240016 240014 240011 240008 240007 240004 239999 239998 239997 239996 239994 239993 239990 239989...
output:
664763392
result:
ok 1 number(s): "664763392"
Test #46:
score: 0
Accepted
time: 784ms
memory: 29732kb
input:
299995 772825 839854 839854 839855 824089 824087 824086 824083 824082 824081 824080 824080 824083 824082 824081 824074 824074 824075 824075 824075 824077 824078 824079 824078 824077 824073 824070 824069 824069 824067 824067 824064 824063 824063 824064 824063 824061 824061 824062 824065 824064 824063...
output:
37411958
result:
ok 1 number(s): "37411958"
Test #47:
score: 0
Accepted
time: 805ms
memory: 29816kb
input:
300000 1000000 999995 999995 999996 999997 999996 999996 999995 999993 999993 999992 999992 999991 999991 999991 999991 999996 999992 999991 999990 999990 999992 999991 999990 999987 999984 999984 999984 999982 999980 999980 999979 999979 999980 999979 999979 999980 999980 999979 999979 999979 99997...
output:
450879006
result:
ok 1 number(s): "450879006"
Test #48:
score: 0
Accepted
time: 808ms
memory: 30392kb
input:
299996 58 58 58 58 60 58 55 55 56 49 48 48 47 47 48 49 51 50 48 46 43 42 42 44 45 47 49 50 50 53 53 53 54 51 50 50 52 53 55 54 53 51 51 51 51 58 57 54 51 51 51 51 52 51 50 47 46 43 43 43 43 45 47 46 43 40 39 38 38 41 41 41 38 38 35 35 36 35 35 35 34 34 36 34 34 35 36 33 30 29 28 27 26 23 20 20 18 18...
output:
298459941
result:
ok 1 number(s): "298459941"
Test #49:
score: 0
Accepted
time: 882ms
memory: 29268kb
input:
299996 999998 999997 999995 999995 999995 999993 999993 999993 999990 999990 999990 999990 999990 999989 999987 999986 999986 999988 999989 999988 999988 999990 999997 999994 999990 999989 999989 999988 999987 999987 999988 999986 999986 999987 999988 999979 999977 999974 999971 999970 999970 999970...
output:
490613738
result:
ok 1 number(s): "490613738"
Test #50:
score: 0
Accepted
time: 890ms
memory: 29080kb
input:
300000 999997 999996 999993 999993 999994 999995 999996 999996 999996 999996 999999 999998 999998 999998 999997 999996 999996 999996 999996 999997 999997 999997 999999 1000000 486 486 487 479 469 466 466 467 468 467 467 468 468 468 467 467 468 466 463 463 463 461 459 459 456 453 452 447 447 448 449 ...
output:
395820026
result:
ok 1 number(s): "395820026"
Test #51:
score: 0
Accepted
time: 933ms
memory: 29420kb
input:
299997 290494 290494 290489 290487 290487 290488 290488 290486 290483 290483 290483 290481 290481 290482 290485 290487 290488 290486 290484 290484 290485 290487 290490 290490 290491 290487 290481 290481 290482 290483 290484 290485 290484 290484 290483 290483 290482 290480 290479 290479 290481 290480...
output:
935739706
result:
ok 1 number(s): "935739706"
Test #52:
score: 0
Accepted
time: 2062ms
memory: 32156kb
input:
299997 1000000 999997 999997 999997 999997 999998 999997 999997 1 1 2 0 0 1 2 994988 994986 994986 994987 994986 994984 994984 994985 994985 994985 994986 994985 994985 994984 994984 994983 994983 994983 994983 994987 994988 994988 994988 994988 994985 994985 994986 994985 994985 994986 994984 99498...
output:
894523307
result:
ok 1 number(s): "894523307"
Test #53:
score: 0
Accepted
time: 2297ms
memory: 33104kb
input:
299995 985715 985715 985716 985714 985713 985713 985715 985715 985715 985716 985716 985715 985715 985716 985719 985714 985714 985715 985715 985715 985717 985715 985715 985716 985715 985714 985714 985715 985715 985718 985714 985712 985712 985713 985713 985712 985712 985714 985713 985712 985712 985714...
output:
773526751
result:
ok 1 number(s): "773526751"
Test #54:
score: 0
Accepted
time: 2185ms
memory: 32200kb
input:
299995 673443 673440 673440 673441 673439 673437 673437 673438 673440 673440 673440 673442 673441 673441 673442 673442 673442 673439 673439 673440 673437 673437 673437 673435 673435 673436 673439 673439 673439 673441 673438 673437 673437 673438 673438 673440 673440 673440 673440 673440 673443 673440...
output:
168543508
result:
ok 1 number(s): "168543508"
Test #55:
score: 0
Accepted
time: 861ms
memory: 46840kb
input:
299999 1000000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
554899496
result:
ok 1 number(s): "554899496"
Test #56:
score: 0
Accepted
time: 874ms
memory: 47444kb
input:
299998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...
output:
677216579
result:
ok 1 number(s): "677216579"
Test #57:
score: 0
Accepted
time: 876ms
memory: 47532kb
input:
299998 598714 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 100000...
output:
558726013
result:
ok 1 number(s): "558726013"
Test #58:
score: 0
Accepted
time: 920ms
memory: 45092kb
input:
300000 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490436 490434 490434 490434 490434 490434 490434 490434 490434 490434 490434...
output:
211401824
result:
ok 1 number(s): "211401824"
Test #59:
score: 0
Accepted
time: 982ms
memory: 44652kb
input:
299997 834526 834522 834522 834522 834522 834523 834523 834524 834524 834525 834525 834525 834525 834528 986989 986989 986990 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 100000...
output:
316134807
result:
ok 1 number(s): "316134807"
Test #60:
score: 0
Accepted
time: 968ms
memory: 42632kb
input:
300000 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598 931598...
output:
820369394
result:
ok 1 number(s): "820369394"
Test #61:
score: 0
Accepted
time: 1000ms
memory: 45240kb
input:
299999 619766 619765 619763 619763 619764 619763 619763 619764 619765 619765 619765 619768 619765 619765 619766 619766 619766 619767 619765 619763 619763 619764 619764 619764 619763 619763 619763 619763 151290 151290 151290 151290 151290 151290 151290 151290 151290 151290 151290 151290 151290 151290...
output:
480415349
result:
ok 1 number(s): "480415349"
Test #62:
score: 0
Accepted
time: 1031ms
memory: 44772kb
input:
299997 9 9 9 9 9 9 9 9 9 9 9 9 8 8 8 8 9 9 8 8 8 8 8 8 8 8 9 9 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 7 7 7 8 8 7 7 7 7 10 10 10 10 11 10 10 9 9 10 9 9 9 9 10 10 10 10 9 9 9 9 9 9 9 9 9 9 8 8 8 8 9 9 9 9 10 10 10 10 10 10 10 10 12 11 11 11 11 11 11 9 9 9 9 9 9 9 9 11 10 10 9 9 9 9 9 9 9 9 10 9 9 9 9 9 9 ...
output:
471824041
result:
ok 1 number(s): "471824041"
Test #63:
score: 0
Accepted
time: 1041ms
memory: 44316kb
input:
299998 1000000 999999 999998 999998 1000000 999999 999999 999997 999997 999996 999996 999997 999998 999997 999996 999996 999999 999999 999999 999999 1000000 999999 999999 1000000 999997 999997 999996 999996 999997 999998 999997 999996 999996 999999 999999 1000000 5 4 4 2 0 0 1 3 3 2 2 2 2 2 2 4 3 3 ...
output:
675389888
result:
ok 1 number(s): "675389888"
Test #64:
score: 0
Accepted
time: 1781ms
memory: 34296kb
input:
299999 999999 999999 1000000 1000000 999999 999998 999998 999999 999998 999997 999997 1000000 1000000 1000000 999997 999997 999998 999997 999997 999998 999995 999993 999993 999994 999994 999993 999993 999994 999993 999993 999997 999994 999993 999993 999994 999994 999992 999992 999989 999989 999989 9...
output:
591732509
result:
ok 1 number(s): "591732509"
Test #65:
score: 0
Accepted
time: 1968ms
memory: 36252kb
input:
299995 5 4 4 5 5 7 7 7 6 6 6 4 3 2 2 5 6 4 4 5 6 6 3 3 3 3 5 0 0 1 2 3 4 3 3 3 2 1 1 4 4 2 2 2 2 4 2 2 1 1 2 4 4 4 2 0 0 1 1 1 2 4 5 6 6 6 8 7 7 365414 365414 365415 365413 365411 365411 365412 365413 365413 365415 373546 373544 373539 373538 373538 373540 373540 373540 373540 373539 373539 373540 3...
output:
954430198
result:
ok 1 number(s): "954430198"
Test #66:
score: 0
Accepted
time: 2052ms
memory: 34680kb
input:
300000 999999 999998 999998 999999 999999 999994 999993 999993 999994 999994 999996 999996 999996 999996 999996 999996 999996 999996 999995 999995 999996 999996 999995 999995 999995 999995 999992 999992 999992 999992 999994 999994 999994 999993 999993 999994 999994 999993 999993 999998 999997 999997...
output:
324161747
result:
ok 1 number(s): "324161747"
Test #67:
score: 0
Accepted
time: 380ms
memory: 44972kb
input:
300000 1000000 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 99995...
output:
300000
result:
ok 1 number(s): "300000"
Test #68:
score: 0
Accepted
time: 380ms
memory: 45940kb
input:
300000 700002 700002 700003 700004 700005 700006 700007 700008 700009 700010 700011 700012 700013 700014 700015 700016 700017 700018 700019 700020 700021 700022 700023 700024 700025 700026 700027 700028 700029 700030 700031 700032 700033 700034 700035 700036 700037 700038 700039 700040 700041 700042...
output:
300000
result:
ok 1 number(s): "300000"
Test #69:
score: 0
Accepted
time: 665ms
memory: 32300kb
input:
299998 940318 940318 940308 940308 940304 940302 940302 940302 940300 940300 940300 940300 940304 940302 940302 940300 940300 940298 940294 940292 940292 940292 940286 940286 940284 940282 940282 940282 940282 940284 940284 940286 940288 940286 940284 940284 940284 940278 940274 940272 940272 940270...
output:
43576446
result:
ok 1 number(s): "43576446"
Test #70:
score: 0
Accepted
time: 692ms
memory: 31228kb
input:
299993 742188 742185 742185 742185 742185 742182 742182 742182 742182 742179 742179 742179 742179 742179 742179 742179 742179 742182 742182 742182 742179 742179 742179 742179 742179 742179 742176 742176 742176 742176 742176 742176 742176 742176 742179 742179 742179 742179 742179 742179 742176 742173...
output:
676440849
result:
ok 1 number(s): "676440849"
Test #71:
score: 0
Accepted
time: 773ms
memory: 29416kb
input:
299941 1000000 1000000 1000000 999996 999996 999996 999996 999996 999996 999992 999992 999988 999988 999988 999988 999988 999988 999988 999988 999984 999984 999984 999984 999984 999984 999984 999984 999984 999984 999984 999984 999980 999976 999976 999976 999976 999976 999976 999972 999972 999972 999...
output:
970230510
result:
ok 1 number(s): "970230510"
Test #72:
score: 0
Accepted
time: 2934ms
memory: 44588kb
input:
299999 999994 999998 999997 999996 999995 999994 1000000 999999 999998 999998 999995 999998 999997 999996 999995 999996 999998 999997 999996 999999 999999 999996 999997 999998 999999 999996 999995 999998 999997 999996 999995 1000000 999999 999999 999996 999998 999997 999996 999996 999996 999997 9999...
output:
85735841
result:
ok 1 number(s): "85735841"
Test #73:
score: 0
Accepted
time: 2123ms
memory: 39928kb
input:
299999 999986 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999987 999987 999988 999989 999990 999991 999992 999993 999994 999995 999996 999997 999998 999999 999998 999998 999999 999984 999985 999986 999987 999988 999989 999990 999991 999992 999993 999994...
output:
550996080
result:
ok 1 number(s): "550996080"
Test #74:
score: 0
Accepted
time: 1658ms
memory: 39400kb
input:
300000 33 38 37 36 35 34 33 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 5 38 38 23 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 38 37 36 35 34 33 32 31 30 29 28 28 15 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16...
output:
964643237
result:
ok 1 number(s): "964643237"
Test #75:
score: 0
Accepted
time: 1560ms
memory: 38340kb
input:
300000 338938 338938 338939 338940 338941 338942 338943 338944 338945 338946 338947 338948 338949 338950 338951 338952 338953 338942 338943 338944 338945 338946 338947 338948 338949 338950 338951 338952 338953 338942 338951 338950 338949 338948 338947 338946 338945 338944 338943 338942 338941 338940...
output:
658149678
result:
ok 1 number(s): "658149678"
Test #76:
score: 0
Accepted
time: 2116ms
memory: 40140kb
input:
300000 713633 713675 713674 713673 713672 713671 713670 713669 713668 713667 713666 713665 713664 713663 713662 713661 713660 713659 713658 713657 713656 713655 713654 713653 713652 713651 713650 713649 713648 713647 713646 713645 713644 713643 713642 713641 713640 713639 713638 713637 713636 713635...
output:
955936919
result:
ok 1 number(s): "955936919"
Test #77:
score: 0
Accepted
time: 3027ms
memory: 37340kb
input:
299999 818023 818024 818025 818026 818027 818028 818029 818030 818031 818032 818033 818034 818035 818036 818037 818038 818039 818040 818041 818042 818043 818044 818045 818046 818047 818048 818049 818050 818051 818052 818053 818054 818055 818056 818057 818058 818059 818060 818061 818062 818063 818064...
output:
181534964
result:
ok 1 number(s): "181534964"
Test #78:
score: -100
Time Limit Exceeded
input:
299999 999999 999999 998989 1000000 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 99996...