QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#497027 | #9141. Array Spread | ucup-team987 | TL | 2278ms | 4144kb | C++17 | 19.6kb | 2024-07-28 18:16:45 | 2024-07-28 18:16:47 |
Judging History
你现在查看的是最新测评结果
- [2024-09-18 18:58:44]
- hack成功,自动添加数据
- (/hack/840)
- [2024-09-18 18:53:02]
- hack成功,自动添加数据
- (/hack/839)
- [2024-07-29 03:53:23]
- hack成功,自动添加数据
- (/hack/753)
- [2024-07-29 03:51:16]
- hack成功,自动添加数据
- (/hack/752)
- [2024-07-29 03:50:24]
- hack成功,自动添加数据
- (/hack/751)
- [2024-07-29 03:48:52]
- hack成功,自动添加数据
- (/hack/750)
- [2024-07-28 18:16:45]
- 提交
answer
/**
* date : 2024-07-28 19:16:31
* author : Nyaan
*/
#define NDEBUG
using namespace std;
// intrinstic
#include <immintrin.h>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfenv>
#include <cfloat>
#include <chrono>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <tuple>
#include <type_traits>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
// utility
namespace Nyaan {
using ll = long long;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128_t;
using u128 = __uint128_t;
template <typename T>
using V = vector<T>;
template <typename T>
using VV = vector<vector<T>>;
using vi = vector<int>;
using vl = vector<long long>;
using vd = V<double>;
using vs = V<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
template <typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
template <typename T, typename U>
struct P : pair<T, U> {
template <typename... Args>
P(Args... args) : pair<T, U>(args...) {}
using pair<T, U>::first;
using pair<T, U>::second;
P &operator+=(const P &r) {
first += r.first;
second += r.second;
return *this;
}
P &operator-=(const P &r) {
first -= r.first;
second -= r.second;
return *this;
}
P &operator*=(const P &r) {
first *= r.first;
second *= r.second;
return *this;
}
template <typename S>
P &operator*=(const S &r) {
first *= r, second *= r;
return *this;
}
P operator+(const P &r) const { return P(*this) += r; }
P operator-(const P &r) const { return P(*this) -= r; }
P operator*(const P &r) const { return P(*this) *= r; }
template <typename S>
P operator*(const S &r) const {
return P(*this) *= r;
}
P operator-() const { return P{-first, -second}; }
};
using pl = P<ll, ll>;
using pi = P<int, int>;
using vp = V<pl>;
constexpr int inf = 1001001001;
constexpr long long infLL = 4004004004004004004LL;
template <typename T>
int sz(const T &t) {
return t.size();
}
template <typename T, typename U>
inline bool amin(T &x, U y) {
return (y < x) ? (x = y, true) : false;
}
template <typename T, typename U>
inline bool amax(T &x, U y) {
return (x < y) ? (x = y, true) : false;
}
template <typename T>
inline T Max(const vector<T> &v) {
return *max_element(begin(v), end(v));
}
template <typename T>
inline T Min(const vector<T> &v) {
return *min_element(begin(v), end(v));
}
template <typename T>
inline long long Sum(const vector<T> &v) {
return accumulate(begin(v), end(v), 0LL);
}
template <typename T>
int lb(const vector<T> &v, const T &a) {
return lower_bound(begin(v), end(v), a) - begin(v);
}
template <typename T>
int ub(const vector<T> &v, const T &a) {
return upper_bound(begin(v), end(v), a) - begin(v);
}
constexpr long long TEN(int n) {
long long ret = 1, x = 10;
for (; n; x *= x, n >>= 1) ret *= (n & 1 ? x : 1);
return ret;
}
template <typename T, typename U>
pair<T, U> mkp(const T &t, const U &u) {
return make_pair(t, u);
}
template <typename T>
vector<T> mkrui(const vector<T> &v, bool rev = false) {
vector<T> ret(v.size() + 1);
if (rev) {
for (int i = int(v.size()) - 1; i >= 0; i--) ret[i] = v[i] + ret[i + 1];
} else {
for (int i = 0; i < int(v.size()); i++) ret[i + 1] = ret[i] + v[i];
}
return ret;
};
template <typename T>
vector<T> mkuni(const vector<T> &v) {
vector<T> ret(v);
sort(ret.begin(), ret.end());
ret.erase(unique(ret.begin(), ret.end()), ret.end());
return ret;
}
template <typename F>
vector<int> mkord(int N, F f) {
vector<int> ord(N);
iota(begin(ord), end(ord), 0);
sort(begin(ord), end(ord), f);
return ord;
}
template <typename T>
vector<int> mkinv(vector<T> &v) {
int max_val = *max_element(begin(v), end(v));
vector<int> inv(max_val + 1, -1);
for (int i = 0; i < (int)v.size(); i++) inv[v[i]] = i;
return inv;
}
vector<int> mkiota(int n) {
vector<int> ret(n);
iota(begin(ret), end(ret), 0);
return ret;
}
template <typename T>
T mkrev(const T &v) {
T w{v};
reverse(begin(w), end(w));
return w;
}
template <typename T>
bool nxp(T &v) {
return next_permutation(begin(v), end(v));
}
// 返り値の型は入力の T に依存
// i 要素目 : [0, a[i])
template <typename T>
vector<vector<T>> product(const vector<T> &a) {
vector<vector<T>> ret;
vector<T> v;
auto dfs = [&](auto rc, int i) -> void {
if (i == (int)a.size()) {
ret.push_back(v);
return;
}
for (int j = 0; j < a[i]; j++) v.push_back(j), rc(rc, i + 1), v.pop_back();
};
dfs(dfs, 0);
return ret;
}
// F : function(void(T&)), mod を取る操作
// T : 整数型のときはオーバーフローに注意する
template <typename T>
T Power(T a, long long n, const T &I, const function<void(T &)> &f) {
T res = I;
for (; n; f(a = a * a), n >>= 1) {
if (n & 1) f(res = res * a);
}
return res;
}
// T : 整数型のときはオーバーフローに注意する
template <typename T>
T Power(T a, long long n, const T &I = T{1}) {
return Power(a, n, I, function<void(T &)>{[](T &) -> void {}});
}
template <typename T>
T Rev(const T &v) {
T res = v;
reverse(begin(res), end(res));
return res;
}
template <typename T>
vector<T> Transpose(const vector<T> &v) {
using U = typename T::value_type;
if(v.empty()) return {};
int H = v.size(), W = v[0].size();
vector res(W, T(H, U{}));
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
res[j][i] = v[i][j];
}
}
return res;
}
template <typename T>
vector<T> Rotate(const vector<T> &v, int clockwise = true) {
using U = typename T::value_type;
int H = v.size(), W = v[0].size();
vector res(W, T(H, U{}));
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (clockwise) {
res[W - 1 - j][i] = v[i][j];
} else {
res[j][H - 1 - i] = v[i][j];
}
}
}
return res;
}
} // namespace Nyaan
// bit operation
namespace Nyaan {
__attribute__((target("popcnt"))) inline int popcnt(const u64 &a) {
return __builtin_popcountll(a);
}
inline int lsb(const u64 &a) { return a ? __builtin_ctzll(a) : 64; }
inline int ctz(const u64 &a) { return a ? __builtin_ctzll(a) : 64; }
inline int msb(const u64 &a) { return a ? 63 - __builtin_clzll(a) : -1; }
template <typename T>
inline int gbit(const T &a, int i) {
return (a >> i) & 1;
}
template <typename T>
inline void sbit(T &a, int i, bool b) {
if (gbit(a, i) != b) a ^= T(1) << i;
}
constexpr long long PW(int n) { return 1LL << n; }
constexpr long long MSK(int n) { return (1LL << n) - 1; }
} // namespace Nyaan
// inout
namespace Nyaan {
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << p.first << " " << p.second;
return os;
}
template <typename T, typename U>
istream &operator>>(istream &is, pair<T, U> &p) {
is >> p.first >> p.second;
return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
int s = (int)v.size();
for (int i = 0; i < s; i++) os << (i ? " " : "") << v[i];
return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
for (auto &x : v) is >> x;
return is;
}
istream &operator>>(istream &is, __int128_t &x) {
string S;
is >> S;
x = 0;
int flag = 0;
for (auto &c : S) {
if (c == '-') {
flag = true;
continue;
}
x *= 10;
x += c - '0';
}
if (flag) x = -x;
return is;
}
istream &operator>>(istream &is, __uint128_t &x) {
string S;
is >> S;
x = 0;
for (auto &c : S) {
x *= 10;
x += c - '0';
}
return is;
}
ostream &operator<<(ostream &os, __int128_t x) {
if (x == 0) return os << 0;
if (x < 0) os << '-', x = -x;
string S;
while (x) S.push_back('0' + x % 10), x /= 10;
reverse(begin(S), end(S));
return os << S;
}
ostream &operator<<(ostream &os, __uint128_t x) {
if (x == 0) return os << 0;
string S;
while (x) S.push_back('0' + x % 10), x /= 10;
reverse(begin(S), end(S));
return os << S;
}
void in() {}
template <typename T, class... U>
void in(T &t, U &...u) {
cin >> t;
in(u...);
}
void out() { cout << "\n"; }
template <typename T, class... U, char sep = ' '>
void out(const T &t, const U &...u) {
cout << t;
if (sizeof...(u)) cout << sep;
out(u...);
}
struct IoSetupNya {
IoSetupNya() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
cerr << fixed << setprecision(7);
}
} iosetupnya;
} // namespace Nyaan
// debug
#ifdef NyaanDebug
#define trc(...) (void(0))
#else
#define trc(...) (void(0))
#endif
#ifdef NyaanLocal
#define trc2(...) (void(0))
#else
#define trc2(...) (void(0))
#endif
// macro
#define each(x, v) for (auto&& x : v)
#define each2(x, y, v) for (auto&& [x, y] : v)
#define all(v) (v).begin(), (v).end()
#define rep(i, N) for (long long i = 0; i < (long long)(N); i++)
#define repr(i, N) for (long long i = (long long)(N)-1; i >= 0; i--)
#define rep1(i, N) for (long long i = 1; i <= (long long)(N); i++)
#define repr1(i, N) for (long long i = (N); (long long)(i) > 0; i--)
#define reg(i, a, b) for (long long i = (a); i < (b); i++)
#define regr(i, a, b) for (long long i = (b)-1; i >= (a); i--)
#define fi first
#define se second
#define ini(...) \
int __VA_ARGS__; \
in(__VA_ARGS__)
#define inl(...) \
long long __VA_ARGS__; \
in(__VA_ARGS__)
#define ins(...) \
string __VA_ARGS__; \
in(__VA_ARGS__)
#define in2(s, t) \
for (int i = 0; i < (int)s.size(); i++) { \
in(s[i], t[i]); \
}
#define in3(s, t, u) \
for (int i = 0; i < (int)s.size(); i++) { \
in(s[i], t[i], u[i]); \
}
#define in4(s, t, u, v) \
for (int i = 0; i < (int)s.size(); i++) { \
in(s[i], t[i], u[i], v[i]); \
}
#define die(...) \
do { \
Nyaan::out(__VA_ARGS__); \
return; \
} while (0)
namespace Nyaan {
void solve();
}
int main() { Nyaan::solve(); }
//
template <typename T>
struct edge {
int src, to;
T cost;
edge(int _to, T _cost) : src(-1), to(_to), cost(_cost) {}
edge(int _src, int _to, T _cost) : src(_src), to(_to), cost(_cost) {}
edge &operator=(const int &x) {
to = x;
return *this;
}
operator int() const { return to; }
};
template <typename T>
using Edges = vector<edge<T>>;
template <typename T>
using WeightedGraph = vector<Edges<T>>;
using UnweightedGraph = vector<vector<int>>;
// Input of (Unweighted) Graph
UnweightedGraph graph(int N, int M = -1, bool is_directed = false,
bool is_1origin = true) {
UnweightedGraph g(N);
if (M == -1) M = N - 1;
for (int _ = 0; _ < M; _++) {
int x, y;
cin >> x >> y;
if (is_1origin) x--, y--;
g[x].push_back(y);
if (!is_directed) g[y].push_back(x);
}
return g;
}
// Input of Weighted Graph
template <typename T>
WeightedGraph<T> wgraph(int N, int M = -1, bool is_directed = false,
bool is_1origin = true) {
WeightedGraph<T> g(N);
if (M == -1) M = N - 1;
for (int _ = 0; _ < M; _++) {
int x, y;
cin >> x >> y;
T c;
cin >> c;
if (is_1origin) x--, y--;
g[x].emplace_back(x, y, c);
if (!is_directed) g[y].emplace_back(y, x, c);
}
return g;
}
// Input of Edges
template <typename T>
Edges<T> esgraph([[maybe_unused]] int N, int M, int is_weighted = true,
bool is_1origin = true) {
Edges<T> es;
for (int _ = 0; _ < M; _++) {
int x, y;
cin >> x >> y;
T c;
if (is_weighted)
cin >> c;
else
c = 1;
if (is_1origin) x--, y--;
es.emplace_back(x, y, c);
}
return es;
}
// Input of Adjacency Matrix
template <typename T>
vector<vector<T>> adjgraph(int N, int M, T INF, int is_weighted = true,
bool is_directed = false, bool is_1origin = true) {
vector<vector<T>> d(N, vector<T>(N, INF));
for (int _ = 0; _ < M; _++) {
int x, y;
cin >> x >> y;
T c;
if (is_weighted)
cin >> c;
else
c = 1;
if (is_1origin) x--, y--;
d[x][y] = c;
if (!is_directed) d[y][x] = c;
}
return d;
}
/**
* @brief グラフテンプレート
* @docs docs/graph/graph-template.md
*/
template <typename T>
struct Dual_of_Shortest_Path {
int N;
WeightedGraph<T> g;
T INF;
vector<T> d;
Dual_of_Shortest_Path(int _n)
: N(_n), g(N), INF(numeric_limits<T>::max() / 2.1), d(N, INF) {}
// add constraint f(j) <= f(i) + w
void add_edge(int i, int j, T c) { g[i].emplace_back(i, j, c); }
// if s != -1, solve max{f(t) - f(s)} for each t
// if unsatisfiable, return empty vector
vector<T> solve(int start = -1) {
vector<int> pending(N), times(N);
queue<int> Q;
for (int i = 0; i < N; i++) {
if (start == i or start == -1) Q.emplace(i), pending[i] = true, d[i] = 0;
}
while (!Q.empty()) {
int p = Q.front();
Q.pop();
pending[p] = false;
for (auto& e : g[p]) {
if (d[p] + e.cost < d[e.to]) {
d[e.to] = d[p] + e.cost;
if (!pending[e.to]) {
if (++times[e.to] >= N) return {};
pending[e.to] = true;
Q.emplace(e.to);
}
}
}
}
return d;
}
};
/**
* @brief 牛ゲー(最短路問題の双対)
*/
//
template <uint32_t mod>
struct LazyMontgomeryModInt {
using mint = LazyMontgomeryModInt;
using i32 = int32_t;
using u32 = uint32_t;
using u64 = uint64_t;
static constexpr u32 get_r() {
u32 ret = mod;
for (i32 i = 0; i < 4; ++i) ret *= 2 - mod * ret;
return ret;
}
static constexpr u32 r = get_r();
static constexpr u32 n2 = -u64(mod) % mod;
static_assert(mod < (1 << 30), "invalid, mod >= 2 ^ 30");
static_assert((mod & 1) == 1, "invalid, mod % 2 == 0");
static_assert(r * mod == 1, "this code has bugs.");
u32 a;
constexpr LazyMontgomeryModInt() : a(0) {}
constexpr LazyMontgomeryModInt(const int64_t &b)
: a(reduce(u64(b % mod + mod) * n2)){};
static constexpr u32 reduce(const u64 &b) {
return (b + u64(u32(b) * u32(-r)) * mod) >> 32;
}
constexpr mint &operator+=(const mint &b) {
if (i32(a += b.a - 2 * mod) < 0) a += 2 * mod;
return *this;
}
constexpr mint &operator-=(const mint &b) {
if (i32(a -= b.a) < 0) a += 2 * mod;
return *this;
}
constexpr mint &operator*=(const mint &b) {
a = reduce(u64(a) * b.a);
return *this;
}
constexpr mint &operator/=(const mint &b) {
*this *= b.inverse();
return *this;
}
constexpr mint operator+(const mint &b) const { return mint(*this) += b; }
constexpr mint operator-(const mint &b) const { return mint(*this) -= b; }
constexpr mint operator*(const mint &b) const { return mint(*this) *= b; }
constexpr mint operator/(const mint &b) const { return mint(*this) /= b; }
constexpr bool operator==(const mint &b) const {
return (a >= mod ? a - mod : a) == (b.a >= mod ? b.a - mod : b.a);
}
constexpr bool operator!=(const mint &b) const {
return (a >= mod ? a - mod : a) != (b.a >= mod ? b.a - mod : b.a);
}
constexpr mint operator-() const { return mint() - mint(*this); }
constexpr mint operator+() const { return mint(*this); }
constexpr mint pow(u64 n) const {
mint ret(1), mul(*this);
while (n > 0) {
if (n & 1) ret *= mul;
mul *= mul;
n >>= 1;
}
return ret;
}
constexpr mint inverse() const {
int x = get(), y = mod, u = 1, v = 0, t = 0, tmp = 0;
while (y > 0) {
t = x / y;
x -= t * y, u -= t * v;
tmp = x, x = y, y = tmp;
tmp = u, u = v, v = tmp;
}
return mint{u};
}
friend ostream &operator<<(ostream &os, const mint &b) {
return os << b.get();
}
friend istream &operator>>(istream &is, mint &b) {
int64_t t;
is >> t;
b = LazyMontgomeryModInt<mod>(t);
return (is);
}
constexpr u32 get() const {
u32 ret = reduce(a);
return ret >= mod ? ret - mod : ret;
}
static constexpr u32 get_mod() { return mod; }
};
using namespace std;
// コンストラクタの MAX に 「C(n, r) や fac(n) でクエリを投げる最大の n 」
// を入れると倍速くらいになる
// mod を超えて前計算して 0 割りを踏むバグは対策済み
template <typename T>
struct Binomial {
vector<T> f, g, h;
Binomial(int MAX = 0) {
assert(T::get_mod() != 0 && "Binomial<mint>()");
f.resize(1, T{1});
g.resize(1, T{1});
h.resize(1, T{1});
if (MAX > 0) extend(MAX + 1);
}
void extend(int m = -1) {
int n = f.size();
if (m == -1) m = n * 2;
m = min<int>(m, T::get_mod());
if (n >= m) return;
f.resize(m);
g.resize(m);
h.resize(m);
for (int i = n; i < m; i++) f[i] = f[i - 1] * T(i);
g[m - 1] = f[m - 1].inverse();
h[m - 1] = g[m - 1] * f[m - 2];
for (int i = m - 2; i >= n; i--) {
g[i] = g[i + 1] * T(i + 1);
h[i] = g[i] * f[i - 1];
}
}
T fac(int i) {
if (i < 0) return T(0);
while (i >= (int)f.size()) extend();
return f[i];
}
T finv(int i) {
if (i < 0) return T(0);
while (i >= (int)g.size()) extend();
return g[i];
}
T inv(int i) {
if (i < 0) return -inv(-i);
while (i >= (int)h.size()) extend();
return h[i];
}
T C(int n, int r) {
if (n < 0 || n < r || r < 0) return T(0);
return fac(n) * finv(n - r) * finv(r);
}
inline T operator()(int n, int r) { return C(n, r); }
template <typename I>
T multinomial(const vector<I>& r) {
static_assert(is_integral<I>::value == true);
int n = 0;
for (auto& x : r) {
if (x < 0) return T(0);
n += x;
}
T res = fac(n);
for (auto& x : r) res *= finv(x);
return res;
}
template <typename I>
T operator()(const vector<I>& r) {
return multinomial(r);
}
T C_naive(int n, int r) {
if (n < 0 || n < r || r < 0) return T(0);
T ret = T(1);
r = min(r, n - r);
for (int i = 1; i <= r; ++i) ret *= inv(i) * (n--);
return ret;
}
T P(int n, int r) {
if (n < 0 || n < r || r < 0) return T(0);
return fac(n) * finv(n - r);
}
// [x^r] 1 / (1-x)^n
T H(int n, int r) {
if (n < 0 || r < 0) return T(0);
return r == 0 ? 1 : C(n + r - 1, r);
}
};
//
using namespace Nyaan;
using mint = LazyMontgomeryModInt<998244353>;
// using mint = LazyMontgomeryModInt<1000000007>;
using vm = vector<mint>;
using vvm = vector<vm>;
Binomial<mint> C;
//
using namespace Nyaan;
void q() {
inl(N, M);
vi L(M), R(M);
in2(L, R);
each(x, L) x--;
vi xs = L;
each(x, R) xs.push_back(x);
xs = mkuni(xs);
N = sz(xs);
each(x, L) x = lb(xs, x);
each(x, R) x = lb(xs, x);
double ng = 0.0, ok = 5000.0;
rep(t, 50) {
double m = (ng + ok) / 2;
Dual_of_Shortest_Path<double> ds(N);
rep(i, N - 1) ds.add_edge(i + 1, i, 0);
rep(i, M) {
ds.add_edge(R[i], L[i], -1);
ds.add_edge(L[i], R[i], m);
}
auto ans = ds.solve(N - 1);
(sz(ans) ? ok : ng) = m;
}
double ans = (ok + ng) / 2;
rep1(denom, 20000) {
ll numer = llround(ans * denom);
double bns = 1.0 * numer / denom;
double gosa = abs(ans - bns) / max(ans, bns);
if (gosa < 1e-10) {
cout << mint(numer) / denom << "\n";
return;
}
}
exit(1);
}
void Nyaan::solve() {
int t = 1;
in(t);
while (t--) q();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3820kb
input:
3 3 3 1 3 2 3 1 2 12 6 2 3 5 7 1 9 4 8 1 2 7 11 4 5 3 4 2 3 1 2 4 4 1 1
output:
1 2 499122178
result:
ok 3 number(s): "1 2 499122178"
Test #2:
score: 0
Accepted
time: 18ms
memory: 3616kb
input:
2000 1000000000 1 259923446 367011266 1000000000 1 882434225 971573327 1000000000 1 41585677 470369580 1000000000 1 371902212 947250194 1000000000 1 787209148 924205796 1000000000 1 259074809 960876164 1000000000 1 148079314 188254573 1000000000 1 940091047 948318624 1000000000 1 40636497 743979446 ...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 2000 numbers
Test #3:
score: 0
Accepted
time: 11ms
memory: 3632kb
input:
1000 1000000000 5 575330909 661595447 708422488 913945134 658050911 930246647 786571892 904549453 851755566 969150871 1000000000 2 198072104 844159589 8876188 644559580 1000000000 2 740802634 976972118 783909534 898449184 1000000000 2 871819537 941611957 465883854 640988372 1000000000 1 99458969 462...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 ...
result:
ok 1000 numbers
Test #4:
score: 0
Accepted
time: 17ms
memory: 3564kb
input:
500 1000000000 13 964546318 987364574 367845944 907446075 259314137 890312338 458318546 959971971 353677471 522446336 782931403 845199078 514387878 786979588 532634932 793056892 905393511 960628299 747423889 986373313 796099347 833069525 906969434 971335651 574582540 647534593 1000000000 6 987712893...
output:
3 1 3 1 1 1 1 1 1 3 2 1 1 1 3 1 2 1 1 2 1 3 1 1 1 2 1 2 2 1 1 1 1 1 1 1 3 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 2 1 1 3 1 2 1 1 1 1 2 3 1 1 1 1 1 1 1 3 2 1 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 3 1 1 1 1 1 1 1 2 1 1 2 1 1 1 2 1 4 1 2 1 4 1 3 1 1 1 1 1 2 1 1 4 1 ...
result:
ok 500 numbers
Test #5:
score: 0
Accepted
time: 30ms
memory: 3660kb
input:
250 1000000000 10 844342043 888135880 127033337 726074967 581308029 893912240 414276384 752837267 565680461 863374082 230362895 477723054 210479116 423381051 325072305 427826920 178306222 756423471 376470949 993759748 1000000000 2 468173597 607783582 266359996 863641680 1000000000 7 206599093 941381...
output:
2 1 2 1 3 3 1 1 1 2 1 2 2 1 3 5 2 1 1 1 2 1 2 1 3 1 2 1 3 499122178 1 1 1 1 3 1 1 1 3 3 3 1 4 1 1 1 1 1 1 1 1 5 1 4 2 1 3 1 1 1 2 5 2 1 2 6 2 2 1 2 1 1 1 5 8 2 1 2 1 1 2 2 2 1 1 5 8 3 1 1 1 8 2 6 1 1 4 2 1 1 1 1 2 2 1 2 1 1 1 1 1 1 2 1 2 1 1 4 1 1 3 1 2 3 3 2 5 1 1 1 3 2 1 1 1 3 1 1 2 1 1 1 1 3 1 1 ...
result:
ok 250 numbers
Test #6:
score: 0
Accepted
time: 28ms
memory: 3672kb
input:
250 1000000000 4 10495745 465086423 465086424 609997778 396956207 663037010 253873206 396956206 1000000000 33 596279983 655818820 226461062 338625457 407323582 423049163 711408063 778512581 220274357 226461061 702491412 711408062 686978949 688730316 369564474 434159428 778512582 787885602 675683057 ...
output:
1 2 748683266 5 6 453747435 1 10 6 1 499122183 1 4 3 1 3 1 748683266 2 499122179 10 499122178 1 499122179 4 1 7 1 665496238 2 2 2 332748119 249561090 816745381 499122178 2 499122179 5 3 4 17 1 2 2 3 249561092 1 3 924300328 499122179 2 3 332748120 2 7 3 499122187 6 374341634 1 2 332748120 2 2 2 49912...
result:
ok 250 numbers
Test #7:
score: 0
Accepted
time: 57ms
memory: 3700kb
input:
100 1000000000 17 272213590 960979163 970159974 987653658 201788340 556786243 46564706 948945765 786605927 819103747 510930374 747773556 729597186 850647589 412727504 443334406 685627406 773178988 793614323 909668193 830162056 837607472 416766039 753918198 237455713 993045890 848459092 851118478 463...
output:
8 1 1 2 3 3 1 5 1 2 8 2 1 1 3 1 3 6 3 3 2 3 7 2 1 1 3 1 2 1 5 5 2 2 4 2 7 2 1 6 1 2 5 4 5 4 1 1 1 8 6 1 4 4 5 13 1 4 9 4 8 3 8 5 4 7 1 8 1 1 1 9 2 1 6 4 4 3 1 1 1 10 4 6 11 6 6 1 1 4 1 4 2 2 13 5 1 1 5 8
result:
ok 100 numbers
Test #8:
score: 0
Accepted
time: 40ms
memory: 3596kb
input:
100 1000000000 49 187775019 193881727 145323628 162242601 964365230 971504847 226437670 229819402 46971378 49331905 871327590 883354570 310535966 323031740 904117712 916571909 458902934 484636144 13320536 14923771 571938132 574937141 89751784 102733764 412667720 421251698 908036941 932886651 2663244...
output:
2 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 2 3 1 1 1 1 1 1 3 1 3 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 3 1 1 1 1 3 1 1 1 1 1 2 1 1 1 1 1 2 1 2 2 1 1 1
result:
ok 100 numbers
Test #9:
score: 0
Accepted
time: 51ms
memory: 3688kb
input:
100 1000000000 33 607773622 612059886 773446566 927093401 216659567 357373353 949986996 960422356 67865304 185683459 748675762 867719748 419805439 434936264 83601801 106508219 584299087 639485780 487166380 588591547 670602250 789210083 877816826 902687951 800334389 834278741 90815648 214176329 53952...
output:
4 1 4 6 3 1 1 7 1 1 3 3 1 4 4 1 2 4 1 5 1 2 2 1 2 9 2 1 2 2 1 2 1 2 4 2 2 1 1 3 2 2 2 1 1 1 1 4 1 1 2 1 1 1 2 1 7 1 1 1 6 2 1 3 6 4 10 1 1 3 5 1 1 10 8 1 3 1 1 2 3 1 1 6 1 2 1 2 3 3 2 4 1 3 2 7 1 1 1 1
result:
ok 100 numbers
Test #10:
score: 0
Accepted
time: 62ms
memory: 3624kb
input:
100 1000000000 27 423127198 447304856 209683651 219301129 831320345 879604518 631502329 814498734 130918283 202258454 434769186 463838309 448295746 500976275 778017547 864887407 60178254 66348236 615735891 725460273 78684718 129678593 219427409 221445385 242513397 378886240 549135209 710348598 24951...
output:
748683266 2 332748119 2 855638018 2 2 2 1 1 499122179 1 630470119 1 873463814 10 3 598946613 499122178 499122179 720954257 24956110 686292996 499122178 6 2 499122180 332748122 665496237 27 17 1 15 5 199648872 6 4 3 1 285212675 2 1 4 2 499122186 698771050 844668300 887328319 332748120 1 2 499122179 4...
result:
ok 100 numbers
Test #11:
score: 0
Accepted
time: 93ms
memory: 3696kb
input:
50 1000000000 54 393385964 584227315 530511168 878333402 240442438 693353417 66549203 383382851 432995043 781030135 902504635 941834946 40257869 409360381 186795487 285734229 500620269 578283640 769614926 881642580 651338390 854914246 220143804 506609845 486528251 695975933 659594236 951619961 26914...
output:
6 3 9 1 5 1 5 7 4 9 11 7 4 10 1 1 3 1 1 7 11 12 7 6 6 7 1 14 9 5 3 11 7 5 10 1 1 14 2 8 16 4 4 2 2 6 4 1 1 9
result:
ok 50 numbers
Test #12:
score: 0
Accepted
time: 4ms
memory: 3560kb
input:
50 10 65 7 10 3 6 5 7 7 7 3 9 2 2 3 10 10 10 7 7 2 3 5 6 7 10 3 9 2 8 2 8 8 8 4 8 9 9 9 9 7 9 1 1 3 6 9 10 9 10 2 3 7 8 9 10 2 9 9 10 10 10 5 7 6 10 6 8 4 5 10 10 5 5 5 10 8 8 1 9 6 7 3 6 1 9 2 5 1 10 2 9 8 9 8 8 1 1 2 9 4 9 10 10 7 10 2 3 8 9 10 10 2 4 2 9 4 7 1 3 1 9 10 10 1 4 8 9 7 8 7 8 10 88 6 ...
output:
7 8 7 6 4 4 6 4 6 8 7 6 6 3 499122178 3 3 7 10 4 2 3 5 2 8 2 8 1 4 7 4 4 7 6 1 4 2 5 3 6 4 2 1 6 1 6 3 9 6 4
result:
ok 50 numbers
Test #13:
score: 0
Accepted
time: 156ms
memory: 3708kb
input:
25 1000000000 126 107069149 368376053 479032115 765537110 991540256 997326292 403046092 722244014 490526523 516722534 274125538 310843747 777271932 894507975 30859549 117930127 295842439 932626190 696990395 727705976 919364307 981912430 452436750 754049053 436429356 707440965 255169020 717543449 875...
output:
13 12 14 15 3 8 13 499122178 9 17 3 3 5 6 6 22 3 3 16 6 17 5 6 9 19
result:
ok 25 numbers
Test #14:
score: 0
Accepted
time: 364ms
memory: 3952kb
input:
10 1000000000 69 870434015 950861762 463726401 635711398 333118041 890448132 290535922 477961269 413309490 468893401 200588542 259174530 820993949 902249431 919016091 952057155 32176623 226256591 307850591 328322116 544612131 956816575 794988232 980183910 896176727 934471390 445409718 674881616 3109...
output:
7 21 17 13 6 11 30 26 17 14
result:
ok 10 numbers
Test #15:
score: 0
Accepted
time: 544ms
memory: 3984kb
input:
10 1000000000 226 722573032 815472621 582575925 607010515 411370955 463267466 92061989 217643130 187859011 258319855 811376535 844552673 426496326 431292091 785538560 983675713 328209738 364768843 338697990 509158393 502285144 536085577 202590577 293138489 873383022 956559039 765186726 836986281 219...
output:
15 5 5 12 18 2 13 12 35 8
result:
ok 10 numbers
Test #16:
score: 0
Accepted
time: 3ms
memory: 3572kb
input:
10 10 31 7 8 5 9 2 4 6 10 10 10 4 5 3 6 8 8 4 10 7 8 2 8 2 7 3 4 9 9 4 7 1 8 1 10 3 9 2 5 5 8 5 8 5 8 6 6 2 10 3 7 9 10 9 10 7 7 6 6 9 10 6 7 10 165 10 10 9 9 4 9 9 9 1 1 6 8 2 9 4 6 10 10 8 9 5 9 8 8 6 10 6 6 4 6 1 6 3 7 5 9 2 8 5 6 3 5 6 9 6 8 4 7 5 8 9 9 5 7 10 10 5 8 9 10 5 5 3 8 7 10 1 1 7 8 6 ...
output:
6 9 10 10 10 7 9 9 8 9
result:
ok 10 numbers
Test #17:
score: 0
Accepted
time: 996ms
memory: 3836kb
input:
5 1000000000 63 619459262 977043459 300995683 982228427 410548612 621234006 122929033 763884440 421486730 819706101 340188689 623537684 507398179 844353491 337184385 791508531 349294635 959826734 98096933 650360479 385580668 846357810 364950155 640902318 640098682 994083922 770432519 820631492 66011...
output:
8 17 6 40 44
result:
ok 5 number(s): "8 17 6 40 44"
Test #18:
score: 0
Accepted
time: 2278ms
memory: 4144kb
input:
2 1000000000 1954 214176902 795098577 427614652 861416360 690405909 903037538 224031724 678866146 103017905 175158461 481177251 880591454 774838238 795104831 887429528 996876768 889351335 987035745 391908934 489988622 83670551 709453888 679022699 842242196 78153409 642923089 232797325 414737043 6804...
output:
66 8
result:
ok 2 number(s): "66 8"
Test #19:
score: -100
Time Limit Exceeded
input:
1 1000000000 2000 804998774 935072473 539475366 898950940 227523606 852755701 309719052 650340983 356982928 655220770 783115802 937764030 570168460 665560212 583166562 906377079 947557671 947616592 774446890 997986030 113320562 897048797 39935214 749273732 63763440 415540685 961986268 990569362 9656...
output:
62