QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#113246 | #6520. Classic Problem | maspy | AC ✓ | 525ms | 61028kb | C++23 | 20.1kb | 2023-06-16 19:15:10 | 2023-06-16 19:15:32 |
Judging History
你现在查看的是测评时间为 2023-06-16 19:15:32 的历史记录
- [2023-12-06 00:08:28]
- hack成功,自动添加数据
- (//qoj.ac/hack/481)
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-06-16 19:15:10]
- 提交
answer
#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;
template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'000'000'000;
template <>
constexpr ll infty<ll> = ll(infty<int>) * infty<int> * 2;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * infty<ll>;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;
using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;
#define vv(type, name, h, ...) \
vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) \
vector<vector<vector<type>>> name( \
h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...) \
vector<vector<vector<vector<type>>>> name( \
a, vector<vector<vector<type>>>( \
b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))
// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)
#define FOR_subset(t, s) \
for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define stoi stoll
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
template <typename T, typename U>
T ceil(T x, U y) {
return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U>
T floor(T x, U y) {
return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T, typename U>
pair<T, T> divmod(T x, U y) {
T q = floor(x, y);
return {q, x - q * y};
}
template <typename T, typename U>
T SUM(const vector<U> &A) {
T sum = 0;
for (auto &&a: A) sum += a;
return sum;
}
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) \
sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()
template <typename T>
T POP(deque<T> &que) {
T a = que.front();
que.pop_front();
return a;
}
template <typename T>
T POP(pq<T> &que) {
T a = que.top();
que.pop();
return a;
}
template <typename T>
T POP(pqg<T> &que) {
assert(!que.empty());
T a = que.top();
que.pop();
return a;
}
template <typename T>
T POP(vc<T> &que) {
assert(!que.empty());
T a = que.back();
que.pop_back();
return a;
}
template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
if (check_ok) assert(check(ok));
while (abs(ok - ng) > 1) {
auto x = (ng + ok) / 2;
tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
}
return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
FOR(iter) {
double x = (ok + ng) / 2;
tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
}
return (ok + ng) / 2;
}
template <class T, class S>
inline bool chmax(T &a, const S &b) {
return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
return (a > b ? a = b, 1 : 0);
}
// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
vc<int> A(S.size());
FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
return A;
}
template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
int N = A.size();
vector<T> B(N + 1);
FOR(i, N) { B[i + 1] = B[i] + A[i]; }
if (off == 0) B.erase(B.begin());
return B;
}
// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
vector<int> ids(len(A));
iota(all(ids), 0);
sort(all(ids),
[&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
return ids;
}
// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
vc<T> B(len(I));
FOR(i, len(I)) B[i] = A[I[i]];
return B;
}
#endif
#line 1 "library/other/io.hpp"
// based on yosupo's fastio
#include <unistd.h>
namespace fastio {
#define FASTIO
// クラスが read(), print() を持っているかを判定するメタ関数
struct has_write_impl {
template <class T>
static auto check(T &&x) -> decltype(x.write(), std::true_type{});
template <class T>
static auto check(...) -> std::false_type;
};
template <class T>
class has_write : public decltype(has_write_impl::check<T>(std::declval<T>())) {
};
struct has_read_impl {
template <class T>
static auto check(T &&x) -> decltype(x.read(), std::true_type{});
template <class T>
static auto check(...) -> std::false_type;
};
template <class T>
class has_read : public decltype(has_read_impl::check<T>(std::declval<T>())) {};
struct Scanner {
FILE *fp;
char line[(1 << 15) + 1];
size_t st = 0, ed = 0;
void reread() {
memmove(line, line + st, ed - st);
ed -= st;
st = 0;
ed += fread(line + ed, 1, (1 << 15) - ed, fp);
line[ed] = '\0';
}
bool succ() {
while (true) {
if (st == ed) {
reread();
if (st == ed) return false;
}
while (st != ed && isspace(line[st])) st++;
if (st != ed) break;
}
if (ed - st <= 50) {
bool sep = false;
for (size_t i = st; i < ed; i++) {
if (isspace(line[i])) {
sep = true;
break;
}
}
if (!sep) reread();
}
return true;
}
template <class T, enable_if_t<is_same<T, string>::value, int> = 0>
bool read_single(T &ref) {
if (!succ()) return false;
while (true) {
size_t sz = 0;
while (st + sz < ed && !isspace(line[st + sz])) sz++;
ref.append(line + st, sz);
st += sz;
if (!sz || st != ed) break;
reread();
}
return true;
}
template <class T, enable_if_t<is_integral<T>::value, int> = 0>
bool read_single(T &ref) {
if (!succ()) return false;
bool neg = false;
if (line[st] == '-') {
neg = true;
st++;
}
ref = T(0);
while (isdigit(line[st])) { ref = 10 * ref + (line[st++] & 0xf); }
if (neg) ref = -ref;
return true;
}
template <typename T,
typename enable_if<has_read<T>::value>::type * = nullptr>
inline bool read_single(T &x) {
x.read();
return true;
}
bool read_single(double &ref) {
string s;
if (!read_single(s)) return false;
ref = std::stod(s);
return true;
}
bool read_single(char &ref) {
string s;
if (!read_single(s) || s.size() != 1) return false;
ref = s[0];
return true;
}
template <class T>
bool read_single(vector<T> &ref) {
for (auto &d: ref) {
if (!read_single(d)) return false;
}
return true;
}
template <class T, class U>
bool read_single(pair<T, U> &p) {
return (read_single(p.first) && read_single(p.second));
}
template <size_t N = 0, typename T>
void read_single_tuple(T &t) {
if constexpr (N < std::tuple_size<T>::value) {
auto &x = std::get<N>(t);
read_single(x);
read_single_tuple<N + 1>(t);
}
}
template <class... T>
bool read_single(tuple<T...> &tpl) {
read_single_tuple(tpl);
return true;
}
void read() {}
template <class H, class... T>
void read(H &h, T &... t) {
bool f = read_single(h);
assert(f);
read(t...);
}
Scanner(FILE *fp) : fp(fp) {}
};
struct Printer {
Printer(FILE *_fp) : fp(_fp) {}
~Printer() { flush(); }
static constexpr size_t SIZE = 1 << 15;
FILE *fp;
char line[SIZE], small[50];
size_t pos = 0;
void flush() {
fwrite(line, 1, pos, fp);
pos = 0;
}
void write(const char val) {
if (pos == SIZE) flush();
line[pos++] = val;
}
template <class T, enable_if_t<is_integral<T>::value, int> = 0>
void write(T val) {
if (pos > (1 << 15) - 50) flush();
if (val == 0) {
write('0');
return;
}
if (val < 0) {
write('-');
val = -val; // todo min
}
size_t len = 0;
while (val) {
small[len++] = char(0x30 | (val % 10));
val /= 10;
}
for (size_t i = 0; i < len; i++) { line[pos + i] = small[len - 1 - i]; }
pos += len;
}
void write(const string s) {
for (char c: s) write(c);
}
void write(const char *s) {
size_t len = strlen(s);
for (size_t i = 0; i < len; i++) write(s[i]);
}
void write(const double x) {
ostringstream oss;
oss << fixed << setprecision(15) << x;
string s = oss.str();
write(s);
}
void write(const long double x) {
ostringstream oss;
oss << fixed << setprecision(15) << x;
string s = oss.str();
write(s);
}
template <typename T,
typename enable_if<has_write<T>::value>::type * = nullptr>
inline void write(T x) {
x.write();
}
template <class T>
void write(const vector<T> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) write(' ');
write(val[i]);
}
}
template <class T, class U>
void write(const pair<T, U> val) {
write(val.first);
write(' ');
write(val.second);
}
template <size_t N = 0, typename T>
void write_tuple(const T t) {
if constexpr (N < std::tuple_size<T>::value) {
if constexpr (N > 0) { write(' '); }
const auto x = std::get<N>(t);
write(x);
write_tuple<N + 1>(t);
}
}
template <class... T>
bool write(tuple<T...> tpl) {
write_tuple(tpl);
return true;
}
template <class T, size_t S>
void write(const array<T, S> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) write(' ');
write(val[i]);
}
}
void write(i128 val) {
string s;
bool negative = 0;
if (val < 0) {
negative = 1;
val = -val;
}
while (val) {
s += '0' + int(val % 10);
val /= 10;
}
if (negative) s += "-";
reverse(all(s));
if (len(s) == 0) s = "0";
write(s);
}
};
Scanner scanner = Scanner(stdin);
Printer printer = Printer(stdout);
void flush() { printer.flush(); }
void print() { printer.write('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
printer.write(head);
if (sizeof...(Tail)) printer.write(' ');
print(forward<Tail>(tail)...);
}
void read() {}
template <class Head, class... Tail>
void read(Head &head, Tail &... tail) {
scanner.read(head);
read(tail...);
}
} // namespace fastio
using fastio::print;
using fastio::flush;
using fastio::read;
#define INT(...) \
int __VA_ARGS__; \
read(__VA_ARGS__)
#define LL(...) \
ll __VA_ARGS__; \
read(__VA_ARGS__)
#define STR(...) \
string __VA_ARGS__; \
read(__VA_ARGS__)
#define CHAR(...) \
char __VA_ARGS__; \
read(__VA_ARGS__)
#define DBL(...) \
double __VA_ARGS__; \
read(__VA_ARGS__)
#define VEC(type, name, size) \
vector<type> name(size); \
read(name)
#define VV(type, name, h, w) \
vector<vector<type>> name(h, vector<type>(w)); \
read(name)
void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"
#line 2 "library/graph/base.hpp"
template <typename T>
struct Edge {
int frm, to;
T cost;
int id;
};
template <typename T = int, bool directed = false>
struct Graph {
int N, M;
using cost_type = T;
using edge_type = Edge<T>;
vector<edge_type> edges;
vector<int> indptr;
vector<edge_type> csr_edges;
vc<int> vc_deg, vc_indeg, vc_outdeg;
bool prepared;
class OutgoingEdges {
public:
OutgoingEdges(const Graph* G, int l, int r) : G(G), l(l), r(r) {}
const edge_type* begin() const {
if (l == r) { return 0; }
return &G->csr_edges[l];
}
const edge_type* end() const {
if (l == r) { return 0; }
return &G->csr_edges[r];
}
private:
const Graph* G;
int l, r;
};
bool is_prepared() { return prepared; }
constexpr bool is_directed() { return directed; }
Graph() : N(0), M(0), prepared(0) {}
Graph(int N) : N(N), M(0), prepared(0) {}
void build(int n) {
N = n, M = 0;
prepared = 0;
edges.clear();
indptr.clear();
csr_edges.clear();
vc_deg.clear();
vc_indeg.clear();
vc_outdeg.clear();
}
void add(int frm, int to, T cost = 1, int i = -1) {
assert(!prepared);
assert(0 <= frm && 0 <= to && to < N);
if (i == -1) i = M;
auto e = edge_type({frm, to, cost, i});
edges.eb(e);
++M;
}
// wt, off
void read_tree(bool wt = false, int off = 1) { read_graph(N - 1, wt, off); }
void read_graph(int M, bool wt = false, int off = 1) {
for (int m = 0; m < M; ++m) {
INT(a, b);
a -= off, b -= off;
if (!wt) {
add(a, b);
} else {
T c;
read(c);
add(a, b, c);
}
}
build();
}
void build() {
assert(!prepared);
prepared = true;
indptr.assign(N + 1, 0);
for (auto&& e: edges) {
indptr[e.frm + 1]++;
if (!directed) indptr[e.to + 1]++;
}
for (int v = 0; v < N; ++v) { indptr[v + 1] += indptr[v]; }
auto counter = indptr;
csr_edges.resize(indptr.back() + 1);
for (auto&& e: edges) {
csr_edges[counter[e.frm]++] = e;
if (!directed)
csr_edges[counter[e.to]++] = edge_type({e.to, e.frm, e.cost, e.id});
}
}
OutgoingEdges operator[](int v) const {
assert(prepared);
return {this, indptr[v], indptr[v + 1]};
}
vc<int> deg_array() {
if (vc_deg.empty()) calc_deg();
return vc_deg;
}
pair<vc<int>, vc<int>> deg_array_inout() {
if (vc_indeg.empty()) calc_deg_inout();
return {vc_indeg, vc_outdeg};
}
int deg(int v) {
if (vc_deg.empty()) calc_deg();
return vc_deg[v];
}
int in_deg(int v) {
if (vc_indeg.empty()) calc_deg_inout();
return vc_indeg[v];
}
int out_deg(int v) {
if (vc_outdeg.empty()) calc_deg_inout();
return vc_outdeg[v];
}
void debug() {
print("Graph");
if (!prepared) {
print("frm to cost id");
for (auto&& e: edges) print(e.frm, e.to, e.cost, e.id);
} else {
print("indptr", indptr);
print("frm to cost id");
FOR(v, N) for (auto&& e: (*this)[v]) print(e.frm, e.to, e.cost, e.id);
}
}
vc<int> new_idx;
vc<bool> used_e;
// G における頂点 V[i] が、新しいグラフで i になるようにする
// {G, es}
pair<Graph<T, directed>, vc<int>> rearrange(vc<int> V) {
if (len(new_idx) != N) new_idx.assign(N, -1);
if (len(used_e) != M) used_e.assign(M, 0);
int n = len(V);
FOR(i, n) new_idx[V[i]] = i;
Graph<T, directed> G(n);
vc<int> es;
FOR(i, n) {
for (auto&& e: (*this)[V[i]]) {
if (used_e[e.id]) continue;
int a = e.frm, b = e.to;
if (new_idx[a] != -1 && new_idx[b] != -1) {
used_e[e.id] = 1;
G.add(new_idx[a], new_idx[b], e.cost);
es.eb(e.id);
}
}
}
FOR(i, n) new_idx[V[i]] = -1;
for (auto&& eid: es) used_e[eid] = 0;
G.build();
return {G, es};
}
private:
void calc_deg() {
assert(vc_deg.empty());
vc_deg.resize(N);
for (auto&& e: edges) vc_deg[e.frm]++, vc_deg[e.to]++;
}
void calc_deg_inout() {
assert(vc_indeg.empty());
vc_indeg.resize(N);
vc_outdeg.resize(N);
for (auto&& e: edges) { vc_indeg[e.to]++, vc_outdeg[e.frm]++; }
}
};
#line 2 "library/ds/unionfind/unionfind.hpp"
struct UnionFind {
int n, n_comp;
vc<int> dat; // par or (-size)
UnionFind(int n = 0) { build(n); }
void build(int m) {
n = m, n_comp = m;
dat.assign(n, -1);
}
void reset() { build(n); }
int operator[](int x) {
while (dat[x] >= 0) {
int pp = dat[dat[x]];
if (pp < 0) { return dat[x]; }
x = dat[x] = pp;
}
return x;
}
ll size(int x) {
assert(dat[x] < 0);
return -dat[x];
}
bool merge(int x, int y) {
x = (*this)[x], y = (*this)[y];
if (x == y) return false;
if (-dat[x] < -dat[y]) swap(x, y);
dat[x] += dat[y], dat[y] = x, n_comp--;
return true;
}
};
#line 6 "main.cpp"
void solve() {
LL(LIM, M);
using T = tuple<int, int, int>;
VEC(T, dat, M);
// 次数 0 じゃない点
vi X;
for (auto&& [a, b, c]: dat) X.eb(a), X.eb(b);
X.eb(1);
X.eb(LIM);
UNIQUE(X);
vc<pi> V; // closed
FOR(i, len(X)) {
V.eb(X[i], X[i]);
if (i == len(X) - 1) break;
ll a = X[i], b = X[i + 1];
if (a + 1 <= b - 1) V.eb(a + 1, b - 1);
}
ll N = len(V);
auto comp = [&](ll x) -> int {
int idx = lower_bound(all(V), pi{x, LIM + 1}) - V.begin() - 1;
auto [a, b] = V[idx];
assert(a <= x && x <= b);
return idx;
};
// for (auto&& v: V) print(v);
ll base = 0;
for (auto&& [a, b]: V) base += b - a;
vc<set<int>> nbd(N);
for (auto&& [a, b, c]: dat) {
a = comp(a), b = comp(b);
assert(a != b);
nbd[a].insert(b);
nbd[b].insert(a);
}
// 右方向に通常辺をはることを考える
vc<int> NXT(N, -1);
FOR(i, N) {
// 次に通常辺をはれる座標は?
int j = i + 1;
while (nbd[i].count(j)) { ++j; }
if (j == N) continue;
dat.eb(i, j, V[j].fi - V[i].se);
// j の右側近傍にのみ、貼ることを検討する
for (auto&& k: nbd[j]) {
if (j >= k) continue;
if (nbd[i].count(k)) continue;
dat.eb(i, k, V[k].fi - V[i].se);
}
}
sort(all(dat),
[&](auto& a, auto& b) -> bool { return (get<2>(a)) < (get<2>(b)); });
UnionFind uf(N);
ll ANS = 0;
for (auto&& [a, b, c]: dat) {
if (uf.merge(a, b)) ANS += c;
}
ANS += base;
print(ANS);
}
signed main() {
INT(T);
FOR(T) solve();
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3528kb
input:
3 5 3 1 2 5 2 3 4 1 5 0 5 0 5 4 1 2 1000000000 1 3 1000000000 1 4 1000000000 1 5 1000000000
output:
4 4 1000000003
result:
ok 3 number(s): "4 4 1000000003"
Test #2:
score: 0
Accepted
time: 382ms
memory: 61028kb
input:
16 1000000000 0 447 99681 1 2 1000000000 1 3 1000000000 2 3 1000000000 1 4 1000000000 2 4 1000000000 3 4 1000000000 1 5 1000000000 2 5 1000000000 3 5 1000000000 4 5 1000000000 1 6 1000000000 2 6 1000000000 3 6 1000000000 4 6 1000000000 5 6 1000000000 1 7 1000000000 2 7 1000000000 3 7 1000000000 4 7 ...
output:
999999999 446000000000 732256441 999999680 999899999 999966830 127 4 2186 1562 1176 5100 5 503 679 4
result:
ok 16 numbers
Test #3:
score: 0
Accepted
time: 525ms
memory: 57220kb
input:
5 1000000000 100000 158260500 877914550 822889311 24979400 861648750 548830120 433933400 476190600 342858071 211047200 971407750 480845266 731963950 822804750 449656269 430302150 982631900 545923679 880895700 923078500 816372580 189330700 910286900 135599877 303238500 404539650 605997004 492686550 7...
output:
999999999 999999999 999999999 999999999 999999999
result:
ok 5 number(s): "999999999 999999999 999999999 999999999 999999999"
Test #4:
score: 0
Accepted
time: 430ms
memory: 52388kb
input:
5 2000 100000 1873 1874 822889311 1290 1291 548830120 1162 1163 342858071 814 815 480845266 742 743 449656269 1609 1610 545923679 1431 1432 816372580 1143 1144 135599877 414 415 605997004 1117 1118 921749002 121 122 786119025 1672 1673 655702582 38 39 211428413 1639 1640 393671555 922 923 501983447 ...
output:
4097 20020 198635 2099999 1000099999
result:
ok 5 number(s): "4097 20020 198635 2099999 1000099999"
Test #5:
score: 0
Accepted
time: 464ms
memory: 42336kb
input:
5 100000 100000 36426 60522 446755913 60522 90081 181424399 3497 60522 625711486 60522 94325 647639160 60522 68417 160714711 35902 60522 61020590 23857 60522 626006012 29211 60522 547865075 60522 63340 561330066 60016 60522 650693494 24593 60522 849028504 60522 90310 285323416 11431 60522 990607689 ...
output:
100024 150003 200003 250000 999999999
result:
ok 5 number(s): "100024 150003 200003 250000 999999999"
Test #6:
score: 0
Accepted
time: 446ms
memory: 21376kb
input:
5 4000 100000 694 696 619136615 1611 1614 829153748 2551 2552 370724298 3034 3037 49559541 98 105 443754249 822 827 735959328 878 885 201346483 2729 2731 304071225 3961 3965 557890416 1631 1637 430215474 3195 3205 212882505 503 507 937363346 3141 3150 47574456 577 583 727402691 3673 3675 279029853 3...
output:
43935 6913 4336 18350 12678
result:
ok 5 number(s): "43935 6913 4336 18350 12678"
Test #7:
score: 0
Accepted
time: 460ms
memory: 59940kb
input:
5 100000 100000 73979 73980 5250107 1946 1947 757506029 87433 87434 443673136 64352 64354 338125488 69103 69104 235256717 60843 60845 20769731 23601 23602 214534313 92417 92419 669411181 57364 57365 519766962 42029 42031 827237806 98524 98525 593643533 71482 71483 662414293 6709 6710 745687608 36460...
output:
166767 127085 110197 1000033410 1000009975
result:
ok 5 number(s): "166767 127085 110197 1000033410 1000009975"
Test #8:
score: 0
Accepted
time: 245ms
memory: 32444kb
input:
5 1000000000 50000 46934929 214668318 1 539508531 807854772 3 81957905 439197851 0 259767671 917896915 1 415730678 521821941 0 728421737 764345460 2 266428928 403328188 2 287022349 739465773 2 374255863 866291129 2 260858097 908362294 1 413843056 908357026 3 498835884 656136616 4 294506717 617875204...
output:
999989920 999949999 999990020 999949999 999991707
result:
ok 5 number(s): "999989920 999949999 999990020 999949999 999991707"
Test #9:
score: 0
Accepted
time: 350ms
memory: 9460kb
input:
10 318 50000 202 215 664792164 27 240 237398902 211 303 234481289 30 100 677362025 22 264 146815592 119 291 400424695 259 315 252405962 216 247 5088627 157 290 178189323 155 316 734981880 193 247 88649525 111 284 566532841 131 228 543880192 35 295 517550073 11 162 662675576 222 260 74089536 317 318 ...
output:
23819960 39448612 8097046 59114094 45057369 51858561 4062351 79061552 43095015 16693179
result:
ok 10 numbers
Test #10:
score: 0
Accepted
time: 236ms
memory: 4220kb
input:
100 102 5000 48 70 8432902 25 75 334675824 56 84 328506917 62 66 204777391 14 27 171625816 26 63 83629619 57 101 321540985 41 85 311469363 15 66 351390467 25 26 211230409 35 74 290758638 11 52 127872342 29 41 36722590 7 40 305168650 57 59 281651751 13 19 227794663 11 68 263248839 11 13 201312984 4 3...
output:
26178167 22787545 57728222 59428785 9611076 18313917 46857052 2980349 14019519 7766478 32126352 23015186 24398047 5999746 38936614 16904414 35847382 20532753 4984654 19717352 5263678 25996814 15710632 604534 14654144 6955086 27641478 3343419 23105160 26432195 5553390 7056453 53902303 169550500 23592...
result:
ok 100 numbers
Test #11:
score: 0
Accepted
time: 207ms
memory: 3696kb
input:
500 50 1000 30 37 244841531 34 50 162121748 2 24 54057560 13 25 99874751 6 23 8670341 34 39 89926367 1 22 221235953 6 24 105286564 13 34 326397341 3 46 290792604 11 24 346530259 28 36 211580979 3 9 238363354 11 28 280948971 6 36 179816637 18 32 156586941 20 23 98299400 12 50 111363373 22 26 11434081...
output:
189 220 230 182 158 173 200 220 189 164 176 202 142 198 172 239 197 192 183 162 157 250 152 216 243 164 196 189 201 180 183 210 191 202 191 184 178 181 228 210 192 204 219 200 198 215 224 202 143 182 223 186 187 196 218 179 209 178 177 184 182 223 227 199 182 220 208 203 165 205 187 191 201 188 197 ...
result:
ok 500 numbers
Test #12:
score: 0
Accepted
time: 167ms
memory: 3564kb
input:
5000 16 100 7 11 287768961 9 16 301149044 4 6 274782222 9 10 450284038 4 7 235183489 2 16 58894948 2 7 238261638 1 15 4511525 4 14 199094011 9 15 18708487 10 14 424492139 5 12 289396677 6 10 205753555 14 16 379921511 9 14 361051609 8 11 462083923 12 16 49451818 7 13 207151488 9 11 468320084 7 9 4016...
output:
84 71179265 61 63 4255393 72 25533862 58 87249761 71 84 19481903 71 46709478 822790 10042255 24930386 63 69894 58 48150185 862500 224220 42138089 740049 8599540 58154641 67865973 14516424 70 87090761 67494787 13034240 91 5581460 331588 67 9506689 80 34867161 43217292 75264458 56 1335841 22470126 266...
result:
ok 5000 numbers
Test #13:
score: 0
Accepted
time: 191ms
memory: 3640kb
input:
5000 2000 100 268 269 623604670 964 965 850016410 1696 1697 958745313 1507 1508 723608729 970 971 753143786 1384 1385 247122568 1448 1449 877299742 1096 1097 795129348 1042 1043 221000653 357 358 298701522 1767 1768 316413195 515 516 229633720 1682 1683 901777899 1181 1182 693437267 1960 1961 867110...
output:
2099 10099 100099 2000099 1000000099 2099 10099 100099 2000099 1000000099 2099 10099 100099 2000099 1000000099 2099 10099 100099 2000099 1000000099 2099 10099 100099 2000099 1000000099 2099 10099 100099 2000099 1000000099 2099 10099 100099 2000099 1000000099 2099 10099 100099 2000099 1000000099 2099...
result:
ok 5000 numbers