QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#134066#1426. Expzyz07AC ✓1362ms42648kbC++1715.3kb2023-08-02 22:27:572023-08-02 22:27:59

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-02 22:27:59]
  • 评测
  • 测评结果:AC
  • 用时:1362ms
  • 内存:42648kb
  • [2023-08-02 22:27:57]
  • 提交

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 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

using namespace std;
#define For(Ti,Ta,Tb) for(auto Ti=(Ta);Ti<=(Tb);++Ti)
#define Dec(Ti,Ta,Tb) for(auto Ti=(Ta);Ti>=(Tb);--Ti)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define range(Tx) begin(Tx),end(Tx)
using ll=long long;
using mint=atcoder::modint998244353;
const int K=105,M=1e7+5;
int n,k,m;
mint poly[K],f[M];
int main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	cin>>n>>k>>m;
	For(i,0,k){
		string s;
		cin>>s;
		poly[i]=stoi(s.substr(s.find('.')+1))/mint(10000);
	}
	f[0]=poly[0].pow(n);
	For(i,0,m-1){
		For(a,max(0,i-k+1),i){
			f[i+1]+=n*f[a]*(i-a+1)*poly[i-a+1];
		}
		For(a,max(0,i-k),i-1){
			f[i+1]-=(a+1)*f[a+1]*poly[i-a];
		}
		f[i+1]/=(i+1)*poly[0];
	}
	mint ans=0,sprob=0;
	For(i,0,m){
		ans+=f[i]*i;
		sprob+=f[i];
	}
	cout<<(ans+(1-sprob)*m).val()<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 42552kb

input:

2 1 2
0.5000 0.5000

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 0ms
memory: 42576kb

input:

2 1 1
0.5000 0.5000

output:

249561089

result:

ok 1 number(s): "249561089"

Test #3:

score: 0
Accepted
time: 1ms
memory: 42516kb

input:

4 2 5
0.2000 0.5000 0.3000

output:

909700083

result:

ok 1 number(s): "909700083"

Test #4:

score: 0
Accepted
time: 3ms
memory: 42552kb

input:

10 4 23
0.4533 0.2906 0.1618 0.0071 0.0872

output:

433575862

result:

ok 1 number(s): "433575862"

Test #5:

score: 0
Accepted
time: 0ms
memory: 42548kb

input:

1 1 1
0.0765 0.9235

output:

299972429

result:

ok 1 number(s): "299972429"

Test #6:

score: 0
Accepted
time: 9ms
memory: 42584kb

input:

1 100 1
0.0072 0.0153 0.0002 0.0067 0.0035 0.0030 0.0013 0.0025 0.0090 0.0100 0.0173 0.0018 0.0072 0.0037 0.0078 0.0060 0.0083 0.0054 0.0069 0.0002 0.0143 0.0132 0.0101 0.0027 0.0167 0.0065 0.0051 0.0001 0.0175 0.0079 0.0107 0.0018 0.0017 0.0031 0.0130 0.0108 0.0050 0.0045 0.0322 0.0040 0.0043 0.009...

output:

521482851

result:

ok 1 number(s): "521482851"

Test #7:

score: 0
Accepted
time: 1ms
memory: 42648kb

input:

1 100 100
0.0048 0.0100 0.0025 0.0254 0.0183 0.0014 0.0188 0.0019 0.0197 0.0171 0.0127 0.0052 0.0038 0.0052 0.0014 0.0016 0.0133 0.0341 0.0014 0.0234 0.0073 0.0001 0.0088 0.0304 0.0032 0.0008 0.0046 0.0236 0.0039 0.0359 0.0023 0.0096 0.0392 0.0169 0.0018 0.0184 0.0051 0.0050 0.0190 0.0053 0.0034 0.0...

output:

276513735

result:

ok 1 number(s): "276513735"

Test #8:

score: 0
Accepted
time: 5ms
memory: 42636kb

input:

1 100 50
0.0011 0.0004 0.0044 0.0005 0.0126 0.0035 0.0099 0.0012 0.0069 0.0151 0.0106 0.0136 0.0036 0.0011 0.0129 0.0056 0.0048 0.0003 0.0047 0.0038 0.0043 0.0261 0.0028 0.0135 0.0153 0.0047 0.0003 0.0195 0.0084 0.0001 0.0133 0.0010 0.0077 0.0010 0.0027 0.0009 0.0369 0.0163 0.0063 0.0047 0.0176 0.00...

output:

892729966

result:

ok 1 number(s): "892729966"

Test #9:

score: 0
Accepted
time: 321ms
memory: 42636kb

input:

1 100 500000
0.0109 0.0243 0.0069 0.0016 0.0114 0.0102 0.0004 0.0004 0.0028 0.0023 0.0327 0.0016 0.0031 0.0022 0.0121 0.0052 0.0022 0.0015 0.0017 0.0008 0.0004 0.0115 0.0027 0.0385 0.0147 0.0025 0.0269 0.0018 0.0083 0.0124 0.0025 0.0053 0.0008 0.0043 0.0122 0.0041 0.0019 0.0163 0.0042 0.0016 0.0019 ...

output:

333912792

result:

ok 1 number(s): "333912792"

Test #10:

score: 0
Accepted
time: 114ms
memory: 42524kb

input:

8 72 228189
0.0008 0.0027 0.0315 0.0128 0.0225 0.0081 0.0300 0.0196 0.0036 0.0232 0.0034 0.0180 0.0096 0.0042 0.0371 0.0170 0.0018 0.0179 0.0341 0.0032 0.0233 0.0345 0.0270 0.0048 0.0053 0.0211 0.0091 0.0124 0.0005 0.0531 0.0218 0.0239 0.0208 0.0019 0.0050 0.0011 0.0356 0.0349 0.0037 0.0079 0.0275 0...

output:

569398839

result:

ok 1 number(s): "569398839"

Test #11:

score: 0
Accepted
time: 3ms
memory: 42508kb

input:

4 19 72
0.0476 0.0007 0.0782 0.0134 0.0315 0.0557 0.0190 0.0002 0.2025 0.0286 0.0470 0.0353 0.1561 0.0025 0.0498 0.1487 0.0093 0.0008 0.0376 0.0355

output:

823827368

result:

ok 1 number(s): "823827368"

Test #12:

score: 0
Accepted
time: 90ms
memory: 42572kb

input:

47 65 187288
0.0020 0.0243 0.0276 0.0448 0.0076 0.0544 0.0145 0.0051 0.0019 0.0003 0.0048 0.0069 0.0050 0.0487 0.0403 0.0019 0.0060 0.0023 0.0017 0.0023 0.0073 0.0003 0.0029 0.0015 0.0114 0.0055 0.0020 0.0081 0.0416 0.0079 0.0085 0.0657 0.0257 0.0012 0.0539 0.0112 0.0131 0.0120 0.0177 0.0162 0.0345 ...

output:

621109149

result:

ok 1 number(s): "621109149"

Test #13:

score: 0
Accepted
time: 1ms
memory: 42552kb

input:

59 66 3151
0.0008 0.0216 0.0292 0.0429 0.0015 0.0034 0.0048 0.0212 0.0092 0.0022 0.0184 0.0034 0.0132 0.0090 0.0184 0.0149 0.0014 0.0130 0.0069 0.0482 0.0342 0.0026 0.0035 0.0033 0.0007 0.0250 0.0133 0.0341 0.0086 0.0186 0.0009 0.0354 0.0050 0.0324 0.0055 0.0148 0.0204 0.0053 0.0286 0.0207 0.0155 0....

output:

303091183

result:

ok 1 number(s): "303091183"

Test #14:

score: 0
Accepted
time: 182ms
memory: 42528kb

input:

180 32 660230
0.0030 0.0559 0.1585 0.0189 0.0250 0.0313 0.0043 0.0212 0.0238 0.0312 0.0031 0.0218 0.0530 0.0102 0.0161 0.0162 0.0008 0.0643 0.0210 0.0098 0.0018 0.0124 0.0254 0.0012 0.0358 0.0280 0.0027 0.0613 0.0669 0.0908 0.0026 0.0674 0.0143

output:

213627137

result:

ok 1 number(s): "213627137"

Test #15:

score: 0
Accepted
time: 14ms
memory: 42532kb

input:

825 97 24822
0.0007 0.0128 0.0072 0.0105 0.0015 0.0065 0.0092 0.0034 0.0616 0.0136 0.0005 0.0007 0.0289 0.0037 0.0226 0.0122 0.0028 0.0490 0.0054 0.0007 0.0024 0.0020 0.0078 0.0139 0.0285 0.0292 0.0156 0.0070 0.0054 0.0009 0.0016 0.0343 0.0032 0.0088 0.0006 0.0031 0.0013 0.0010 0.0178 0.0102 0.0077 ...

output:

751468909

result:

ok 1 number(s): "751468909"

Test #16:

score: 0
Accepted
time: 188ms
memory: 42548kb

input:

8457 70 393095
0.0086 0.0013 0.0439 0.0011 0.0031 0.0046 0.0141 0.0029 0.0072 0.0236 0.0047 0.0057 0.0125 0.0087 0.0033 0.0344 0.0194 0.0149 0.0015 0.0238 0.0060 0.0006 0.0318 0.0099 0.0039 0.0886 0.0100 0.0513 0.0008 0.0048 0.0192 0.0183 0.0329 0.0306 0.0209 0.0127 0.0011 0.0004 0.0014 0.0718 0.023...

output:

287615827

result:

ok 1 number(s): "287615827"

Test #17:

score: 0
Accepted
time: 47ms
memory: 42580kb

input:

2813 100 64953
0.0135 0.0052 0.0002 0.0199 0.0031 0.0090 0.0010 0.0019 0.0079 0.0016 0.0232 0.0095 0.0027 0.0183 0.0011 0.0049 0.0039 0.0057 0.0111 0.0088 0.0068 0.0591 0.0290 0.0011 0.0172 0.0185 0.0021 0.0093 0.0048 0.0146 0.0205 0.0174 0.0004 0.0175 0.0020 0.0279 0.0084 0.0049 0.0201 0.0025 0.000...

output:

888752966

result:

ok 1 number(s): "888752966"

Test #18:

score: 0
Accepted
time: 261ms
memory: 42632kb

input:

28076 23 1109371
0.0271 0.0007 0.0611 0.0134 0.0876 0.0115 0.0895 0.0136 0.0992 0.0761 0.0225 0.0012 0.0576 0.0397 0.0006 0.0128 0.0070 0.1054 0.0005 0.0209 0.1228 0.0670 0.0187 0.0435

output:

977815323

result:

ok 1 number(s): "977815323"

Test #19:

score: 0
Accepted
time: 187ms
memory: 42600kb

input:

11532 49 500231
0.0634 0.0079 0.0355 0.0156 0.0313 0.0148 0.0050 0.0156 0.0045 0.0155 0.0088 0.0747 0.0203 0.0453 0.0008 0.0345 0.0164 0.0191 0.0181 0.0126 0.0040 0.0135 0.0090 0.0008 0.0280 0.0060 0.0102 0.0239 0.0067 0.0002 0.0225 0.0207 0.0089 0.0578 0.0454 0.0274 0.0111 0.0287 0.0236 0.0058 0.03...

output:

765424220

result:

ok 1 number(s): "765424220"

Test #20:

score: 0
Accepted
time: 278ms
memory: 42648kb

input:

905859 82 512437
0.0046 0.0022 0.0053 0.0003 0.0034 0.0055 0.0127 0.0066 0.0091 0.0477 0.0485 0.0031 0.0079 0.0128 0.0046 0.0018 0.0253 0.0234 0.0145 0.0116 0.0112 0.0036 0.0021 0.0144 0.0257 0.0017 0.0115 0.0133 0.0370 0.0050 0.0050 0.0112 0.0151 0.0291 0.0002 0.0194 0.0026 0.0081 0.0002 0.0031 0.0...

output:

305815667

result:

ok 1 number(s): "305815667"

Test #21:

score: 0
Accepted
time: 205ms
memory: 42572kb

input:

726087 22 903003
0.0211 0.0269 0.0082 0.0049 0.0372 0.0207 0.0421 0.0592 0.0257 0.0048 0.1405 0.0722 0.2035 0.0197 0.1515 0.0085 0.0272 0.0037 0.0030 0.0288 0.0281 0.0213 0.0412

output:

165751013

result:

ok 1 number(s): "165751013"

Test #22:

score: 0
Accepted
time: 256ms
memory: 42520kb

input:

8499639 12 1484189
0.0008 0.0178 0.0426 0.1374 0.0315 0.0325 0.1429 0.1461 0.0152 0.1629 0.1879 0.0092 0.0732

output:

956102781

result:

ok 1 number(s): "956102781"

Test #23:

score: 0
Accepted
time: 46ms
memory: 42572kb

input:

7975090 80 80834
0.0503 0.0007 0.0018 0.0064 0.0451 0.0290 0.0086 0.0265 0.0225 0.0009 0.0008 0.0027 0.0116 0.0017 0.0097 0.0104 0.0055 0.0041 0.0263 0.0012 0.0069 0.0036 0.0111 0.0049 0.0141 0.0041 0.0140 0.0357 0.0008 0.0089 0.0124 0.0036 0.0009 0.0188 0.0034 0.0046 0.0078 0.0119 0.0291 0.0328 0.0...

output:

830002618

result:

ok 1 number(s): "830002618"

Test #24:

score: 0
Accepted
time: 1036ms
memory: 42508kb

input:

9480464 1 9037245
0.5272 0.4728

output:

826765004

result:

ok 1 number(s): "826765004"

Test #25:

score: 0
Accepted
time: 1145ms
memory: 42640kb

input:

10000000 1 10000000
0.2742 0.7258

output:

7258000

result:

ok 1 number(s): "7258000"

Test #26:

score: 0
Accepted
time: 1100ms
memory: 42620kb

input:

9408749 2 9201087
0.6648 0.2247 0.1105

output:

421398208

result:

ok 1 number(s): "421398208"

Test #27:

score: 0
Accepted
time: 1208ms
memory: 42504kb

input:

10000000 2 10000000
0.1573 0.7937 0.0490

output:

557818845

result:

ok 1 number(s): "557818845"

Test #28:

score: 0
Accepted
time: 1136ms
memory: 42512kb

input:

9499951 3 9029606
0.0616 0.5319 0.2706 0.1359

output:

284414453

result:

ok 1 number(s): "284414453"

Test #29:

score: 0
Accepted
time: 1256ms
memory: 42524kb

input:

10000000 3 10000000
0.0602 0.4809 0.1313 0.3276

output:

600502291

result:

ok 1 number(s): "600502291"

Test #30:

score: 0
Accepted
time: 1204ms
memory: 42520kb

input:

9238967 4 9255431
0.3568 0.1637 0.3758 0.1036 0.0001

output:

380750818

result:

ok 1 number(s): "380750818"

Test #31:

score: 0
Accepted
time: 1304ms
memory: 42548kb

input:

10000000 4 10000000
0.0806 0.3086 0.0944 0.4684 0.0480

output:

845020796

result:

ok 1 number(s): "845020796"

Test #32:

score: 0
Accepted
time: 1251ms
memory: 42508kb

input:

9237551 5 9208267
0.0989 0.0964 0.2189 0.3467 0.1859 0.0532

output:

697888991

result:

ok 1 number(s): "697888991"

Test #33:

score: 0
Accepted
time: 1362ms
memory: 42548kb

input:

10000000 5 10000000
0.0462 0.0281 0.0829 0.0999 0.6869 0.0560

output:

727452959

result:

ok 1 number(s): "727452959"

Test #34:

score: 0
Accepted
time: 1086ms
memory: 42516kb

input:

9093059 6 7754196
0.0258 0.0217 0.1677 0.0923 0.6137 0.0603 0.0185

output:

434249728

result:

ok 1 number(s): "434249728"

Test #35:

score: 0
Accepted
time: 1170ms
memory: 42516kb

input:

10000000 6 8333333
0.1267 0.0649 0.0573 0.4131 0.0151 0.0824 0.2405

output:

172212898

result:

ok 1 number(s): "172212898"

Test #36:

score: 0
Accepted
time: 896ms
memory: 42548kb

input:

9157664 8 5974939
0.0200 0.1643 0.0320 0.0376 0.1054 0.0298 0.1281 0.1269 0.3559

output:

488754805

result:

ok 1 number(s): "488754805"

Test #37:

score: 0
Accepted
time: 944ms
memory: 42568kb

input:

10000000 8 6250000
0.0007 0.3504 0.0341 0.2721 0.0347 0.0699 0.0196 0.0747 0.1438

output:

152187512

result:

ok 1 number(s): "152187512"

Test #38:

score: 0
Accepted
time: 780ms
memory: 42572kb

input:

9643755 10 4838939
0.0577 0.0128 0.0179 0.0816 0.1283 0.2276 0.0524 0.0636 0.2163 0.0764 0.0654

output:

860514323

result:

ok 1 number(s): "860514323"

Test #39:

score: 0
Accepted
time: 804ms
memory: 42576kb

input:

10000000 10 5000000
0.0462 0.0430 0.0013 0.0821 0.1555 0.0537 0.3115 0.1085 0.0693 0.0210 0.1079

output:

556648020

result:

ok 1 number(s): "556648020"

Test #40:

score: 0
Accepted
time: 619ms
memory: 42508kb

input:

9430407 13 3503480
0.0867 0.0547 0.0544 0.1939 0.0569 0.0298 0.0413 0.0210 0.0024 0.0075 0.0214 0.0575 0.1853 0.1872

output:

246746208

result:

ok 1 number(s): "246746208"

Test #41:

score: 0
Accepted
time: 682ms
memory: 42636kb

input:

10000000 13 3846153
0.0135 0.0892 0.0039 0.1196 0.0245 0.0786 0.0590 0.1186 0.1014 0.0037 0.0933 0.2125 0.0486 0.0336

output:

529062347

result:

ok 1 number(s): "529062347"

Test #42:

score: 0
Accepted
time: 485ms
memory: 42524kb

input:

9488718 23 2100474
0.0440 0.0098 0.0819 0.0003 0.0793 0.1373 0.0394 0.0442 0.0136 0.0286 0.0101 0.0313 0.1401 0.0560 0.0426 0.0162 0.0082 0.1168 0.0012 0.0382 0.0122 0.0286 0.0178 0.0023

output:

686163187

result:

ok 1 number(s): "686163187"

Test #43:

score: 0
Accepted
time: 507ms
memory: 42544kb

input:

10000000 23 2173913
0.0020 0.0382 0.0291 0.0478 0.1207 0.0255 0.0649 0.0399 0.0174 0.0243 0.0004 0.0195 0.1383 0.0398 0.0530 0.0092 0.0452 0.0503 0.0060 0.0587 0.0532 0.0968 0.0146 0.0052

output:

769614978

result:

ok 1 number(s): "769614978"

Test #44:

score: 0
Accepted
time: 390ms
memory: 42528kb

input:

9129292 42 1164096
0.0178 0.0044 0.0538 0.0015 0.0126 0.0291 0.0145 0.0052 0.0400 0.0262 0.0108 0.0056 0.0537 0.0022 0.0327 0.0180 0.0647 0.0306 0.0008 0.0453 0.0054 0.0554 0.0045 0.0031 0.0257 0.0003 0.0489 0.0466 0.0180 0.0046 0.0451 0.0175 0.0030 0.0148 0.0155 0.0052 0.0084 0.0582 0.0049 0.0201 0...

output:

131238057

result:

ok 1 number(s): "131238057"

Test #45:

score: 0
Accepted
time: 394ms
memory: 42512kb

input:

10000000 42 1190476
0.0011 0.0090 0.0645 0.0010 0.0239 0.0379 0.0098 0.0180 0.0480 0.0278 0.0083 0.0506 0.0152 0.0331 0.0038 0.0066 0.0114 0.0489 0.0155 0.0222 0.0199 0.0604 0.0091 0.0586 0.0034 0.0287 0.0018 0.0124 0.0410 0.0262 0.0202 0.0591 0.0153 0.0095 0.0034 0.0236 0.0002 0.0038 0.0367 0.0315 ...

output:

58257995

result:

ok 1 number(s): "58257995"

Test #46:

score: 0
Accepted
time: 339ms
memory: 42528kb

input:

9746215 58 816167
0.0298 0.0119 0.0009 0.0130 0.0360 0.0113 0.0057 0.0091 0.0200 0.0066 0.0281 0.0104 0.0222 0.0102 0.0144 0.0095 0.0025 0.0039 0.0098 0.0014 0.0471 0.0335 0.0012 0.0019 0.0320 0.0050 0.0054 0.0139 0.0027 0.0237 0.0474 0.0121 0.0015 0.0322 0.0049 0.0133 0.0176 0.0156 0.0394 0.0105 0....

output:

517368042

result:

ok 1 number(s): "517368042"

Test #47:

score: 0
Accepted
time: 365ms
memory: 42516kb

input:

10000000 58 862068
0.0039 0.0155 0.0022 0.0277 0.0082 0.0161 0.0120 0.0090 0.0335 0.0048 0.0288 0.0444 0.0017 0.0163 0.0073 0.0060 0.0271 0.0146 0.0106 0.0121 0.0070 0.0097 0.0033 0.0680 0.0143 0.0101 0.0164 0.0418 0.0175 0.0038 0.0134 0.0551 0.0184 0.0265 0.0318 0.0045 0.0151 0.0029 0.0056 0.0941 0...

output:

392555453

result:

ok 1 number(s): "392555453"

Test #48:

score: 0
Accepted
time: 315ms
memory: 42528kb

input:

9511592 77 599440
0.0265 0.0233 0.0064 0.0018 0.0168 0.0114 0.0144 0.0021 0.0019 0.0024 0.0235 0.0075 0.0124 0.0149 0.0237 0.0254 0.0066 0.0142 0.0036 0.0271 0.0054 0.0037 0.0039 0.0128 0.0047 0.0332 0.0188 0.0075 0.0066 0.0085 0.0153 0.0018 0.0086 0.0134 0.0447 0.0100 0.0055 0.0007 0.0096 0.0458 0....

output:

255364549

result:

ok 1 number(s): "255364549"

Test #49:

score: 0
Accepted
time: 346ms
memory: 42636kb

input:

10000000 77 649350
0.0013 0.0035 0.0045 0.0175 0.0007 0.0067 0.0117 0.0258 0.0097 0.0375 0.0193 0.0035 0.0270 0.0108 0.0049 0.0017 0.0003 0.0078 0.0530 0.0190 0.0236 0.0010 0.0311 0.0212 0.0024 0.0277 0.0111 0.0016 0.0349 0.0012 0.0014 0.0060 0.0015 0.0188 0.0136 0.0085 0.0023 0.0033 0.0036 0.0072 0...

output:

862935731

result:

ok 1 number(s): "862935731"

Test #50:

score: 0
Accepted
time: 315ms
memory: 42512kb

input:

9173503 93 520742
0.0166 0.0009 0.0067 0.0415 0.0026 0.0008 0.0018 0.0032 0.0111 0.0046 0.0224 0.0236 0.0068 0.0060 0.0021 0.0132 0.0039 0.0092 0.0081 0.0161 0.0074 0.0005 0.0208 0.0168 0.0094 0.0167 0.0391 0.0347 0.0015 0.0104 0.0011 0.0419 0.0007 0.0444 0.0006 0.0034 0.0014 0.0445 0.0103 0.0072 0....

output:

745354191

result:

ok 1 number(s): "745354191"

Test #51:

score: 0
Accepted
time: 332ms
memory: 42532kb

input:

10000000 93 537634
0.0075 0.0013 0.0192 0.0492 0.0025 0.0032 0.0068 0.0019 0.0057 0.0059 0.0009 0.0275 0.0185 0.0073 0.0009 0.0102 0.0125 0.0375 0.0458 0.0432 0.0028 0.0041 0.0057 0.0019 0.0120 0.0015 0.0036 0.0113 0.0042 0.0108 0.0002 0.0008 0.0029 0.0037 0.0054 0.0028 0.0125 0.0067 0.0019 0.0156 0...

output:

330711029

result:

ok 1 number(s): "330711029"

Test #52:

score: 0
Accepted
time: 283ms
memory: 42512kb

input:

9785931 100 450201
0.0194 0.0060 0.0097 0.0013 0.0095 0.0200 0.0008 0.0005 0.0040 0.0175 0.0115 0.0101 0.0053 0.0005 0.0077 0.0043 0.0059 0.0091 0.0092 0.0042 0.0148 0.0052 0.0105 0.0153 0.0079 0.0065 0.0098 0.0092 0.0129 0.0094 0.0421 0.0030 0.0089 0.0189 0.0161 0.0357 0.0022 0.0067 0.0026 0.0166 0...

output:

140929335

result:

ok 1 number(s): "140929335"

Test #53:

score: 0
Accepted
time: 320ms
memory: 42520kb

input:

10000000 100 500000
0.0285 0.0181 0.0006 0.0016 0.0104 0.0115 0.0119 0.0060 0.0207 0.0174 0.0337 0.0061 0.0025 0.0250 0.0022 0.0071 0.0056 0.0044 0.0251 0.0025 0.0060 0.0320 0.0027 0.0040 0.0089 0.0204 0.0047 0.0091 0.0015 0.0010 0.0030 0.0023 0.0046 0.0069 0.0065 0.0008 0.0008 0.0144 0.0165 0.0028 ...

output:

102032866

result:

ok 1 number(s): "102032866"