QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#726285 | #6430. Monster Hunter | maspy | AC ✓ | 17ms | 4644kb | C++23 | 19.4kb | 2024-11-08 22:45:55 | 2024-11-08 22:45:56 |
Judging History
answer
#line 1 "/home/maspy/compro/library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
// https://codeforces.com/blog/entry/96344
#pragma GCC optimize("Ofast,unroll-loops")
// いまの CF だとこれ入れると動かない?
// #pragma GCC target("avx2,popcnt")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i128 = __int128;
using u128 = unsigned __int128;
using f128 = __float128;
template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'010'000'000;
template <>
constexpr ll infty<ll> = 2'020'000'000'000'000'000;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * 2'000'000'000'000'000'000;
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); }
int popcnt_sgn(int x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
int popcnt_sgn(u32 x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
int popcnt_sgn(ll x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
int popcnt_sgn(u64 x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
// (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>
T floor(T a, T b) {
return a / b - (a % b && (a ^ b) < 0);
}
template <typename T>
T ceil(T x, T y) {
return floor(x + y - 1, y);
}
template <typename T>
T bmod(T x, T y) {
return x - y * floor(x, y);
}
template <typename T>
pair<T, T> divmod(T x, T y) {
T q = floor(x, y);
return {q, x - q * y};
}
template <typename T, typename U>
T SUM(const vector<U> &A) {
T sm = 0;
for (auto &&a: A) sm += a;
return sm;
}
#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) {
T a = que.top();
que.pop();
return a;
}
template <typename T>
T POP(vc<T> &que) {
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;
(check(x) ? ok : ng) = 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;
(check(x) ? ok : ng) = 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;
}
template <typename T, typename... Vectors>
void concat(vc<T> &first, const Vectors &... others) {
vc<T> &res = first;
(res.insert(res.end(), others.begin(), others.end()), ...);
}
#endif
#line 1 "/home/maspy/compro/library/other/io.hpp"
#define FASTIO
#include <unistd.h>
// https://judge.yosupo.jp/submission/21623
namespace fastio {
static constexpr uint32_t SZ = 1 << 17;
char ibuf[SZ];
char obuf[SZ];
char out[100];
// pointer of ibuf, obuf
uint32_t pil = 0, pir = 0, por = 0;
struct Pre {
char num[10000][4];
constexpr Pre() : num() {
for (int i = 0; i < 10000; i++) {
int n = i;
for (int j = 3; j >= 0; j--) {
num[i][j] = n % 10 | '0';
n /= 10;
}
}
}
} constexpr pre;
inline void load() {
memcpy(ibuf, ibuf + pil, pir - pil);
pir = pir - pil + fread(ibuf + pir - pil, 1, SZ - pir + pil, stdin);
pil = 0;
if (pir < SZ) ibuf[pir++] = '\n';
}
inline void flush() {
fwrite(obuf, 1, por, stdout);
por = 0;
}
void rd(char &c) {
do {
if (pil + 1 > pir) load();
c = ibuf[pil++];
} while (isspace(c));
}
void rd(string &x) {
x.clear();
char c;
do {
if (pil + 1 > pir) load();
c = ibuf[pil++];
} while (isspace(c));
do {
x += c;
if (pil == pir) load();
c = ibuf[pil++];
} while (!isspace(c));
}
template <typename T>
void rd_real(T &x) {
string s;
rd(s);
x = stod(s);
}
template <typename T>
void rd_integer(T &x) {
if (pil + 100 > pir) load();
char c;
do
c = ibuf[pil++];
while (c < '-');
bool minus = 0;
if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
if (c == '-') { minus = 1, c = ibuf[pil++]; }
}
x = 0;
while ('0' <= c) { x = x * 10 + (c & 15), c = ibuf[pil++]; }
if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
if (minus) x = -x;
}
}
void rd(int &x) { rd_integer(x); }
void rd(ll &x) { rd_integer(x); }
void rd(i128 &x) { rd_integer(x); }
void rd(u32 &x) { rd_integer(x); }
void rd(u64 &x) { rd_integer(x); }
void rd(u128 &x) { rd_integer(x); }
void rd(double &x) { rd_real(x); }
void rd(long double &x) { rd_real(x); }
void rd(f128 &x) { rd_real(x); }
template <class T, class U>
void rd(pair<T, U> &p) {
return rd(p.first), rd(p.second);
}
template <size_t N = 0, typename T>
void rd_tuple(T &t) {
if constexpr (N < std::tuple_size<T>::value) {
auto &x = std::get<N>(t);
rd(x);
rd_tuple<N + 1>(t);
}
}
template <class... T>
void rd(tuple<T...> &tpl) {
rd_tuple(tpl);
}
template <size_t N = 0, typename T>
void rd(array<T, N> &x) {
for (auto &d: x) rd(d);
}
template <class T>
void rd(vc<T> &x) {
for (auto &d: x) rd(d);
}
void read() {}
template <class H, class... T>
void read(H &h, T &... t) {
rd(h), read(t...);
}
void wt(const char c) {
if (por == SZ) flush();
obuf[por++] = c;
}
void wt(const string s) {
for (char c: s) wt(c);
}
void wt(const char *s) {
size_t len = strlen(s);
for (size_t i = 0; i < len; i++) wt(s[i]);
}
template <typename T>
void wt_integer(T x) {
if (por > SZ - 100) flush();
if (x < 0) { obuf[por++] = '-', x = -x; }
int outi;
for (outi = 96; x >= 10000; outi -= 4) {
memcpy(out + outi, pre.num[x % 10000], 4);
x /= 10000;
}
if (x >= 1000) {
memcpy(obuf + por, pre.num[x], 4);
por += 4;
} else if (x >= 100) {
memcpy(obuf + por, pre.num[x] + 1, 3);
por += 3;
} else if (x >= 10) {
int q = (x * 103) >> 10;
obuf[por] = q | '0';
obuf[por + 1] = (x - q * 10) | '0';
por += 2;
} else
obuf[por++] = x | '0';
memcpy(obuf + por, out + outi + 4, 96 - outi);
por += 96 - outi;
}
template <typename T>
void wt_real(T x) {
ostringstream oss;
oss << fixed << setprecision(15) << double(x);
string s = oss.str();
wt(s);
}
void wt(int x) { wt_integer(x); }
void wt(ll x) { wt_integer(x); }
void wt(i128 x) { wt_integer(x); }
void wt(u32 x) { wt_integer(x); }
void wt(u64 x) { wt_integer(x); }
void wt(u128 x) { wt_integer(x); }
void wt(double x) { wt_real(x); }
void wt(long double x) { wt_real(x); }
void wt(f128 x) { wt_real(x); }
template <class T, class U>
void wt(const pair<T, U> val) {
wt(val.first);
wt(' ');
wt(val.second);
}
template <size_t N = 0, typename T>
void wt_tuple(const T t) {
if constexpr (N < std::tuple_size<T>::value) {
if constexpr (N > 0) { wt(' '); }
const auto x = std::get<N>(t);
wt(x);
wt_tuple<N + 1>(t);
}
}
template <class... T>
void wt(tuple<T...> tpl) {
wt_tuple(tpl);
}
template <class T, size_t S>
void wt(const array<T, S> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) wt(' ');
wt(val[i]);
}
}
template <class T>
void wt(const vector<T> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) wt(' ');
wt(val[i]);
}
}
void print() { wt('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
wt(head);
if (sizeof...(Tail)) wt(' ');
print(forward<Tail>(tail)...);
}
// gcc expansion. called automaticall after main.
void __attribute__((destructor)) _d() { flush(); }
} // namespace fastio
using fastio::read;
using fastio::print;
using fastio::flush;
#if defined(LOCAL)
#define SHOW(...) SHOW_IMPL(__VA_ARGS__, SHOW6, SHOW5, SHOW4, SHOW3, SHOW2, SHOW1)(__VA_ARGS__)
#define SHOW_IMPL(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
#define SHOW1(x) print(#x, "=", (x)), flush()
#define SHOW2(x, y) print(#x, "=", (x), #y, "=", (y)), flush()
#define SHOW3(x, y, z) print(#x, "=", (x), #y, "=", (y), #z, "=", (z)), flush()
#define SHOW4(x, y, z, w) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w)), flush()
#define SHOW5(x, y, z, w, v) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v)), flush()
#define SHOW6(x, y, z, w, v, u) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v), #u, "=", (u)), flush()
#else
#define SHOW(...)
#endif
#define INT(...) \
int __VA_ARGS__; \
read(__VA_ARGS__)
#define LL(...) \
ll __VA_ARGS__; \
read(__VA_ARGS__)
#define U32(...) \
u32 __VA_ARGS__; \
read(__VA_ARGS__)
#define U64(...) \
u64 __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 "/home/maspy/compro/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 {
static constexpr bool is_directed = directed;
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; }
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;
}
#ifdef FASTIO
// 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();
}
#endif
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];
}
#ifdef FASTIO
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);
}
}
#endif
vc<int> new_idx;
vc<bool> used_e;
// G における頂点 V[i] が、新しいグラフで i になるようにする
// {G, es}
// sum(deg(v)) の計算量になっていて、
// 新しいグラフの n+m より大きい可能性があるので注意
Graph<T, directed> rearrange(vc<int> V, bool keep_eid = 0) {
if (len(new_idx) != N) new_idx.assign(N, -1);
int n = len(V);
FOR(i, n) new_idx[V[i]] = i;
Graph<T, directed> G(n);
vc<int> history;
FOR(i, n) {
for (auto&& e: (*this)[V[i]]) {
if (len(used_e) <= e.id) used_e.resize(e.id + 1);
if (used_e[e.id]) continue;
int a = e.frm, b = e.to;
if (new_idx[a] != -1 && new_idx[b] != -1) {
history.eb(e.id);
used_e[e.id] = 1;
int eid = (keep_eid ? e.id : -1);
G.add(new_idx[a], new_idx[b], e.cost, eid);
}
}
}
FOR(i, n) new_idx[V[i]] = -1;
for (auto&& eid: history) used_e[eid] = 0;
G.build();
return G;
}
Graph<T, true> to_directed_tree(int root = -1) {
if (root == -1) root = 0;
assert(!is_directed && prepared && M == N - 1);
Graph<T, true> G1(N);
vc<int> par(N, -1);
auto dfs = [&](auto& dfs, int v) -> void {
for (auto& e: (*this)[v]) {
if (e.to == par[v]) continue;
par[e.to] = v, dfs(dfs, e.to);
}
};
dfs(dfs, root);
for (auto& e: edges) {
int a = e.frm, b = e.to;
if (par[a] == b) swap(a, b);
assert(par[b] == a);
G1.add(a, b, e.cost);
}
G1.build();
return G1;
}
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 5 "main.cpp"
void solve() {
LL(N);
Graph<int, 1> G(N);
FOR(v, 1, N) {
INT(p);
G.add(--p, v);
}
G.build();
VEC(ll, H, N);
// のこした、けした
auto dfs = [&](auto& dfs, int v) -> pair<vi, vi> {
vi A = {H[v], infty<ll>};
vi B = {infty<ll>, 0};
for (auto& e: G[v]) {
auto [A1, B1] = dfs(dfs, e.to);
ll n = len(A) + len(A1) - 1;
vi C(n + 1, infty<ll>), D(n + 1, infty<ll>);
ll w = H[e.to];
FOR(i, len(A)) {
FOR(j, len(A1)) {
chmin(C[i + j], A[i] + A1[j] + w);
chmin(C[i + j], A[i] + B1[j]);
chmin(D[i + j], B[i] + A1[j]);
chmin(D[i + j], B[i] + B1[j]);
}
}
swap(A, C), swap(B, D);
}
return {A, B};
};
auto [A, B] = dfs(dfs, 0);
vi ANS(N + 1);
FOR(i, N + 1) ANS[i] = min(A[i], B[i]);
print(ANS);
}
signed main() {
INT(T);
FOR(T) solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3720kb
input:
3 5 1 2 3 4 1 2 3 4 5 9 1 2 3 4 3 4 6 6 8 4 9 4 4 5 2 4 1 12 1 2 2 4 5 3 4 3 8 10 11 9 1 3 5 10 10 7 3 7 9 4 9
output:
29 16 9 4 1 0 74 47 35 25 15 11 7 3 1 0 145 115 93 73 55 42 32 22 14 8 4 1 0
result:
ok 29 tokens
Test #2:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
179 20 1 1 1 4 5 5 7 7 9 9 11 12 13 14 5 16 17 16 19 3 9 3 2 7 7 2 8 5 7 5 4 7 4 2 4 9 2 7 9 19 1 1 3 4 3 6 7 6 6 10 10 12 13 13 12 16 16 18 8 8 3 6 10 1 1 1 2 2 3 3 3 10 5 5 7 10 5 2 1 10 4 2 1 2 7 14 1 1 3 4 4 6 4 8 9 10 11 8 13 4 4 6 6 10 8 9 5 7 1 4 7 9 8 6 1 2 3 3 5 2 7 5 6 1 6 11 1 2 3 3 5 6 6...
output:
209 182 159 137 117 99 81 65 56 47 39 32 25 19 15 11 8 6 4 2 0 178 151 129 108 89 74 64 54 44 36 29 23 18 13 10 7 5 2 1 0 18 4 0 16 2 0 172 137 111 93 78 63 49 39 31 23 16 10 5 1 0 52 33 21 9 3 1 0 109 72 53 39 29 22 16 10 5 2 1 0 105 69 47 35 25 17 12 7 3 0 156 133 113 97 82 68 56 44 33 26 19 14 10...
result:
ok 2178 tokens
Test #3:
score: 0
Accepted
time: 1ms
memory: 3980kb
input:
177 10 1 2 3 3 3 6 7 8 3 750920741 600457069 885939487 614833472 917972842 716271451 234536309 280049219 394290544 802674020 5 1 2 2 4 381361244 652246733 111336853 652733347 864548837 7 1 2 2 4 4 4 374076965 100213690 316923584 132783452 321143617 617096325 590521323 14 1 1 3 4 4 6 6 6 4 10 11 10 1...
output:
11644969567 6821338808 5469960998 4515572016 3564764256 2646791414 1844117394 1229283922 628826853 234536309 0 4943092784 2773077253 1145431444 492698097 111336853 0 4531440947 2737112778 2103265610 1466071235 823784001 365780594 100213690 0 15231373225 11922670663 9482266269 7732763282 6052396185 4...
result:
ok 2176 tokens
Test #4:
score: 0
Accepted
time: 0ms
memory: 4168kb
input:
15 97 1 2 2 4 5 2 7 8 9 10 11 11 13 14 15 16 16 16 19 19 21 21 23 24 11 26 26 28 29 30 31 31 33 34 33 36 37 36 39 40 31 42 43 44 43 46 42 48 42 50 51 52 51 54 54 50 57 58 57 28 61 62 62 64 61 66 67 67 67 70 70 72 67 74 67 76 77 61 79 80 81 82 83 82 85 85 87 88 89 88 91 88 93 82 95 96 727261601 26107...
output:
107163950031 102732928896 98999901499 95286804744 91721257442 88258895738 85278119210 82530570741 79871508580 77382736169 74969945304 72561689905 70288550600 68157169720 66078603230 64055840678 62145527840 60274097298 58428791326 56711378906 54998171184 53305415604 51640777030 50049643668 4848686165...
result:
ok 2010 tokens
Test #5:
score: 0
Accepted
time: 2ms
memory: 3860kb
input:
13 171 1 1 3 3 5 6 6 6 9 10 11 12 13 14 15 16 12 6 19 20 20 22 22 24 25 22 27 28 29 27 27 27 33 33 33 36 37 38 39 40 40 42 39 44 33 46 33 48 48 48 51 51 53 53 55 56 53 58 59 48 61 61 63 64 65 66 67 68 69 70 69 72 73 73 72 69 77 69 68 80 81 82 83 84 85 82 87 88 80 90 91 92 93 93 95 93 97 98 99 91 101...
output:
187664021257 183101322620 178652629666 174903443687 171181863321 167508022266 164048979331 160694988110 157366569229 154144572418 150953357906 147898194220 145072963639 142252129359 139436947703 136631607337 133985709265 131363892815 128765304704 126168063880 123664992681 121166439175 118792530215 1...
result:
ok 1969 tokens
Test #6:
score: 0
Accepted
time: 8ms
memory: 4280kb
input:
2 1000 1 2 3 4 5 6 6 8 8 10 11 12 13 14 12 16 17 16 19 20 19 22 22 24 25 26 24 28 29 19 31 32 33 34 35 34 34 33 32 40 41 42 43 42 4 46 47 48 49 49 48 52 53 53 55 56 56 58 58 60 61 62 60 64 65 65 65 68 68 68 71 64 73 64 75 76 77 77 64 80 81 82 81 81 85 86 85 88 88 90 88 92 92 94 95 96 97 97 99 99 101...
output:
1113237056588 1108226059331 1103452926208 1098937464290 1094424834414 1090101107734 1085979381309 1081924835645 1077939941478 1073955392448 1070060014619 1066167943999 1062419631658 1058704177859 1055039647440 1051385794327 1047741820417 1044141128405 1040544084361 1036983950782 1033443541341 102993...
result:
ok 2002 tokens
Test #7:
score: 0
Accepted
time: 10ms
memory: 4364kb
input:
1 2000 1 1 3 4 1 6 7 7 6 10 11 12 12 14 15 11 17 18 18 20 21 22 23 24 22 26 27 28 27 27 31 32 33 34 35 32 37 37 39 39 41 42 43 42 45 10 47 47 49 49 51 49 53 54 55 56 57 57 59 60 61 62 61 64 65 66 67 68 65 70 71 71 73 73 75 75 77 78 75 80 81 82 82 82 85 85 87 88 88 90 88 92 93 92 95 96 97 97 97 100 1...
output:
2218881294575 2213744695667 2209258961365 2204812368487 2200449406724 2196203533720 2192056603090 2187933211280 2183833968547 2179737242326 2175719186934 2171741657318 2167810748823 2163879903171 2159962385119 2156074431587 2152191794989 2148338662389 2144513166298 2140724085981 2136958464736 213322...
result:
ok 2001 tokens
Test #8:
score: 0
Accepted
time: 14ms
memory: 4212kb
input:
1 2000 1 1 3 4 4 4 7 8 9 8 11 12 7 14 15 16 17 17 3 20 21 20 23 24 25 25 27 25 29 29 29 23 33 23 35 35 37 38 39 39 39 42 42 39 45 35 47 47 49 49 51 52 47 54 55 55 57 58 55 60 61 60 60 60 65 66 66 68 69 70 71 69 73 73 75 76 77 76 76 80 81 81 83 83 85 86 87 87 89 90 91 91 93 89 95 80 97 98 99 100 101 ...
output:
2251617273778 2247003039440 2242430225953 2237883166436 2233355730054 2228961190864 2224718903682 2220482730939 2216287724882 2212119854387 2207975346387 2203853324653 2199734356726 2195721269018 2191711933780 2187703738249 2183801657775 2179907800916 2176038498164 2172181973574 2168329662833 216450...
result:
ok 2001 tokens
Test #9:
score: 0
Accepted
time: 14ms
memory: 4152kb
input:
1 2000 1 2 2 1 5 1 1 8 9 9 11 11 13 14 15 16 16 18 16 20 16 22 13 24 25 25 27 28 29 28 31 32 32 28 35 27 37 37 39 40 39 42 43 44 44 46 46 48 49 44 51 52 53 52 55 52 51 58 59 58 61 61 63 63 65 66 67 67 65 70 70 72 73 74 70 76 77 77 79 80 77 65 83 83 85 86 86 88 89 89 91 91 93 93 93 93 97 97 99 100 10...
output:
2206881062084 2202092706920 2197564054211 2193078757615 2188740187606 2184470790404 2180330836648 2176299098130 2172293912044 2168303008199 2164315464017 2160345496700 2156417698598 2152491863648 2148575952119 2144668178439 2140768739007 2136894877679 2133031560312 2129188280081 2125408396292 212163...
result:
ok 2001 tokens
Test #10:
score: 0
Accepted
time: 11ms
memory: 4096kb
input:
1 2000 1 2 3 4 5 6 7 8 9 10 11 10 13 14 14 16 17 16 19 16 13 22 22 13 10 26 27 26 29 26 26 10 33 34 33 9 37 38 39 40 38 42 43 38 45 38 47 47 37 50 51 52 53 54 53 56 53 58 59 52 61 61 63 61 65 52 67 52 69 51 71 50 73 74 74 76 74 78 37 80 81 37 83 83 37 37 37 37 37 9 91 91 93 91 95 9 8 98 99 100 101 1...
output:
2239908981975 2232517414071 2225894512841 2219372844163 2213085150127 2207519039932 2202083361540 2196758986281 2191444012176 2186229941641 2181154413896 2176085010679 2171029257148 2166029667863 2161088940966 2156306922261 2151535754361 2146791775272 2142105755058 2137465141703 2132880168320 212830...
result:
ok 2001 tokens
Test #11:
score: 0
Accepted
time: 14ms
memory: 4376kb
input:
1 2000 1 2 3 4 5 6 7 8 8 7 11 11 13 14 15 16 17 18 19 20 21 22 23 24 25 25 23 28 22 30 31 30 22 34 35 36 37 38 22 22 41 22 43 43 21 20 47 48 49 49 51 51 49 54 48 56 48 58 47 47 20 62 63 63 65 66 67 66 69 66 63 72 73 18 17 16 77 78 79 79 16 82 83 84 84 86 83 82 89 90 91 92 92 94 91 96 89 98 99 100 10...
output:
2187566746517 2182187929991 2176874744181 2172157735355 2167581858172 2163014604257 2158449355514 2153903271574 2149394732089 2144890155305 2140409630299 2135948820472 2131496356723 2127063843406 2122704497177 2118350861665 2114007171456 2109743502902 2105496707054 2101256560940 2097108029529 209296...
result:
ok 2001 tokens
Test #12:
score: 0
Accepted
time: 14ms
memory: 4076kb
input:
1 2000 1 2 3 4 4 6 7 8 9 10 11 12 12 14 15 7 6 18 19 20 21 22 23 24 23 26 27 26 26 30 31 32 33 30 30 36 26 38 39 22 41 41 43 44 45 46 47 48 49 50 50 52 52 47 55 55 45 58 45 44 61 62 61 64 64 64 43 68 69 70 71 68 73 74 74 73 77 78 77 68 68 82 82 22 85 86 87 88 87 90 91 90 93 94 94 94 97 86 99 100 101...
output:
2189791993272 2184503440761 2179558617878 2174909008068 2170291963818 2165729773866 2161186103446 2156743150210 2152327655076 2147979515403 2143644696051 2139346682030 2135121171622 2130925682410 2126769405351 2122695229538 2118629846463 2114651244627 2110684023924 2106730754655 2102782338387 209884...
result:
ok 2001 tokens
Test #13:
score: 0
Accepted
time: 15ms
memory: 4076kb
input:
1 2000 1 2 3 4 5 6 7 8 9 10 10 8 13 14 15 15 17 18 19 20 21 21 23 23 25 25 27 28 29 30 31 31 33 34 35 36 37 37 36 40 41 40 43 43 43 35 47 47 49 50 51 52 53 54 55 53 53 58 59 60 61 61 63 64 63 60 52 49 69 47 71 72 35 74 75 76 77 78 79 79 81 82 83 81 85 85 81 77 89 89 89 92 93 94 94 94 76 98 98 100 10...
output:
2220518092263 2215732319500 2210984793056 2206238533572 2201597531031 2197054470311 2192520546799 2188081300705 2183715317378 2179387838156 2175170120514 2171146207161 2167177667676 2163227064523 2159290434728 2155398316333 2151507487160 2147619095455 2143732109465 2139854894565 2136039327617 213224...
result:
ok 2001 tokens
Test #14:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
134 19 1 2 2 4 5 6 7 7 6 10 11 12 13 14 11 16 17 18 6 7 6 10 5 7 7 8 3 2 6 2 2 6 8 4 2 4 7 10 1 2 2 4 5 6 7 6 9 7 10 6 8 6 7 3 2 9 7 19 1 2 3 4 5 6 7 7 9 4 11 11 13 14 13 16 17 18 5 5 6 2 10 2 9 3 3 6 5 1 5 8 7 9 1 6 1 18 1 2 3 4 5 6 1 8 9 10 11 12 13 14 15 9 17 1 1 9 10 9 5 4 5 8 3 8 6 6 9 6 1 5 1 ...
output:
198 168 143 123 105 88 73 59 51 43 36 30 24 18 13 9 6 4 2 0 123 89 63 45 33 26 19 13 7 2 0 183 156 132 110 94 79 63 50 38 30 23 18 13 10 7 5 3 2 1 0 193 164 140 116 94 72 60 50 40 31 24 18 12 8 5 3 2 1 0 96 66 44 31 21 15 9 5 3 1 0 102 67 46 34 24 14 9 5 2 1 0 119 93 71 49 33 22 14 6 4 2 1 0 175 147...
result:
ok 2127 tokens
Test #15:
score: 0
Accepted
time: 1ms
memory: 3788kb
input:
135 19 1 2 1 4 5 5 7 4 9 9 11 12 11 14 15 14 17 18 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 16 1 1 3 3 5 6 7 6 9 10 11 12 13 14 15 1...
output:
37000000000 33000000000 29000000000 25000000000 22000000000 19000000000 16000000000 14000000000 12000000000 10000000000 9000000000 8000000000 7000000000 6000000000 5000000000 4000000000 3000000000 2000000000 1000000000 0 31000000000 27000000000 23000000000 20000000000 17000000000 14000000000 1200000...
result:
ok 2134 tokens
Test #16:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
130 20 1 1 3 4 4 3 7 7 9 10 10 12 13 14 15 16 17 18 19 890245275 826949747 930998021 227159075 875688785 904342722 518026431 347758838 596601609 889934230 867009820 275688682 589383029 811978241 367558119 549938260 840229119 458907694 122945257 608340046 14 1 2 2 4 5 6 7 5 1 10 11 12 13 354616511 16...
output:
24109120725 21186553763 18538360720 16304011063 14164645131 12173130530 10192717221 8867003864 7582719668 6366039576 5207882480 4213524098 3346514278 2519564531 1922962922 1341109971 973551852 625793014 350104332 122945257 0 12079383037 9912001048 7999694706 6143099517 4542912749 3505539149 26265326...
result:
ok 2129 tokens
Test #17:
score: 0
Accepted
time: 8ms
memory: 4364kb
input:
2 1000 1 2 3 2 5 6 7 8 9 10 7 12 12 14 15 16 17 15 19 19 21 14 23 23 25 26 27 28 29 28 26 32 33 34 35 36 37 38 39 40 39 42 43 44 45 44 47 47 49 50 51 49 53 54 55 56 57 58 59 59 55 62 62 64 65 65 67 67 69 70 71 71 73 74 75 76 77 78 77 80 81 82 80 84 84 86 86 88 89 90 91 92 93 94 95 96 92 98 98 100 10...
output:
1087012935694 1083312606896 1079710047856 1076167857600 1072688415661 1069235844035 1065792043214 1062374798390 1058993816387 1055632934263 1052322356363 1049033592858 1045781646900 1042563691152 1039353881011 1036159077609 1032965722192 1029776323322 1026611904852 1023472572635 1020360346684 101730...
result:
ok 2002 tokens
Test #18:
score: 0
Accepted
time: 15ms
memory: 4560kb
input:
1 2000 1 2 3 4 2 6 6 8 9 10 10 12 13 9 15 16 16 18 19 20 21 21 23 19 25 26 27 28 28 30 31 32 33 34 35 34 31 38 38 40 41 42 40 44 44 46 46 48 49 50 50 52 53 54 55 56 53 58 59 60 61 62 59 64 65 66 64 68 69 70 71 72 73 74 75 76 76 78 79 80 81 82 83 83 85 86 87 88 89 90 88 92 92 94 81 96 97 96 99 100 10...
output:
2216928825336 2213172721244 2209515539543 2205934063386 2202388418437 2198875931031 2195363650791 2191856397793 2188350984431 2184858599496 2181383436910 2177927280009 2174520220932 2171116115080 2167730026415 2164358164229 2160991664849 2157627649373 2154266017190 2150934417303 2147608282237 214429...
result:
ok 2001 tokens
Test #19:
score: 0
Accepted
time: 15ms
memory: 4288kb
input:
1 2000 1 2 3 2 5 6 7 7 9 10 11 12 13 9 15 15 17 18 17 20 21 21 23 23 25 26 27 28 29 30 31 27 33 34 35 36 33 38 39 40 41 38 43 43 45 46 45 48 49 50 50 52 49 54 55 56 56 58 59 60 61 62 55 64 65 66 67 67 65 70 71 72 73 73 70 76 77 78 76 80 81 81 83 80 85 86 87 88 88 90 91 92 91 90 95 96 97 97 96 100 10...
output:
2201970810924 2198248960282 2194562751839 2190913120139 2187304687188 2183715159089 2180136209832 2176566818875 2172999392054 2169437433635 2165984270827 2162536679632 2159120830258 2155736816769 2152369934734 2149024739727 2145710580431 2142404599471 2139109795374 2135818074739 2132536294991 212926...
result:
ok 2001 tokens
Test #20:
score: 0
Accepted
time: 15ms
memory: 4340kb
input:
1 2000 1 1 3 4 5 3 7 8 7 10 11 10 13 13 15 16 17 18 18 17 21 22 23 24 25 26 27 28 25 22 31 32 33 34 35 32 37 38 39 40 40 42 43 44 45 46 42 48 49 50 51 50 53 54 55 56 57 58 59 60 59 62 63 62 65 66 67 68 69 70 71 72 72 69 75 76 67 78 79 80 81 82 83 84 85 81 87 88 88 90 91 90 93 94 94 96 97 98 99 98 10...
output:
2187401111668 2183689466386 2180079363220 2176507318308 2172951923069 2169427183121 2165921444226 2162442570296 2158966209869 2155508634868 2152077320540 2148647109621 2145236377450 2141851435012 2138468106791 2135118722831 2131779011606 2128467949184 2125194940343 2121936521536 2118679496928 211543...
result:
ok 2001 tokens
Test #21:
score: 0
Accepted
time: 17ms
memory: 4100kb
input:
1 2000 1 2 3 4 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
2226121779049 2206228385594 2186717564374 2167311431007 2149006693401 2130830732579 2113751229270 2096797331130 2080184933841 2063587491238 2047228631335 2031257185636 2015287840840 1999424905363 1983705396440 1968219416965 1952806647079 1937601301970 1922417961562 1907290037416 1892177433037 187709...
result:
ok 2001 tokens
Test #22:
score: 0
Accepted
time: 17ms
memory: 4048kb
input:
1 2000 1 2 3 4 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
2209464207001 2202295798471 2195135742059 2188003065423 2180987019303 2174084295895 2167308308316 2160583591271 2153923291837 2147596871721 2141445119821 2135335137730 2129257952268 2123257020381 2117270760269 2111367071643 2105489987994 2099625143552 2093807265178 2088105567227 2082404694611 207678...
result:
ok 2001 tokens
Test #23:
score: 0
Accepted
time: 13ms
memory: 4220kb
input:
1 2000 1 2 3 4 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
2191361115337 2186300372333 2181320664530 2176498138366 2171758313237 2167053032616 2162389836718 2157745042922 2153229119147 2148760730857 2144392919982 2140025614387 2135673755830 2131344840744 2127030128696 2122741711820 2118458958301 2114180422639 2109904965846 2105659760388 2101466174837 209736...
result:
ok 2001 tokens
Test #24:
score: 0
Accepted
time: 11ms
memory: 3952kb
input:
1 2000 1 2 3 4 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
2200234061076 2194286598324 2188496983300 2182830544833 2177282270715 2171741245841 2166250132149 2160759374534 2155346884945 2149964431237 2144727705295 2139597035666 2134511566957 2129525145000 2124659842765 2119823627255 2115045451101 2110284360323 2105572360895 2100901245684 2096278758424 209166...
result:
ok 2001 tokens
Test #25:
score: 0
Accepted
time: 17ms
memory: 4080kb
input:
1 2000 1 2 3 4 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
2189518196372 2183001758211 2177669317563 2172356759949 2167047733513 2161979145764 2156992496584 2152166810550 2147372659237 2142702784059 2138057014938 2133444338772 2128866687129 2124320029523 2119799374674 2115305162892 2110897364571 2106492258479 2102132828397 2097784048981 2093440139408 208910...
result:
ok 2001 tokens
Test #26:
score: 0
Accepted
time: 16ms
memory: 4344kb
input:
1 2000 1 2 3 4 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
2214443505186 2209389012223 2204530127971 2199837867389 2195277444101 2190753360370 2186393008026 2182082181366 2177903364528 2173736296667 2169636929841 2165547134076 2161490657099 2157447321378 2153419746333 2149424059784 2145483291773 2141626443204 2137782909540 2133941790235 2130108229567 212629...
result:
ok 2001 tokens
Test #27:
score: 0
Accepted
time: 16ms
memory: 4644kb
input:
1 2000 1 2 3 4 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
2205408052282 2202428159092 2199464564430 2196525759113 2193596442215 2190704499827 2187815604116 2184926741214 2182039738885 2179155977228 2176276658345 2173400310019 2170526325538 2167655721789 2164805719165 2161961799231 2159122026542 2156292444210 2153474035867 2150656161462 2147843969334 214503...
result:
ok 2001 tokens
Test #28:
score: 0
Accepted
time: 15ms
memory: 4360kb
input:
1 2000 1 2 2 4 5 6 7 7 5 10 11 10 13 14 13 16 17 16 19 20 21 22 20 24 25 26 25 25 29 29 29 32 33 32 35 35 37 38 39 40 39 38 35 44 45 45 47 48 49 50 51 52 53 54 55 53 57 58 59 59 61 62 63 64 64 66 67 68 66 70 71 72 73 74 75 74 77 78 79 80 81 82 83 83 85 86 87 88 85 90 91 92 92 94 95 96 96 98 99 100 1...
output:
2162765933434 2158542822888 2154467669981 2150443202838 2146485925541 2142574396694 2138672197540 2134864693008 2131092000678 2127331883343 2123581906448 2119963701499 2116356176680 2112750931327 2109157400414 2105587577360 2102033294371 2098479389375 2094933474476 2091410727518 2087902199115 208440...
result:
ok 2001 tokens
Test #29:
score: 0
Accepted
time: 15ms
memory: 4100kb
input:
1 2000 1 2 3 1 5 5 7 8 9 7 11 11 5 14 15 5 1 18 19 20 21 22 23 23 25 26 27 28 29 30 31 32 33 31 35 36 37 31 39 29 29 42 23 44 44 46 46 22 21 50 50 52 53 53 55 56 57 58 59 60 61 61 63 64 65 66 67 68 69 70 71 71 73 74 74 76 77 78 79 77 81 82 83 84 85 74 87 88 89 90 91 92 93 94 94 96 97 97 74 100 101 1...
output:
2199868336839 2195301901458 2191038845195 2186884658491 2182804523751 2178829756745 2174869901206 2170945457624 2167029836183 2163121765047 2159280933094 2155496518038 2151736536549 2148005563891 2144288645352 2140594570148 2136973568388 2133355641250 2129743454810 2126134683836 2122528654173 211893...
result:
ok 2001 tokens
Test #30:
score: 0
Accepted
time: 10ms
memory: 3972kb
input:
1 2000 1 2 3 4 5 6 7 7 7 6 11 11 11 6 15 15 15 5 19 20 20 20 19 24 24 24 19 28 28 28 5 32 33 33 33 32 37 37 37 32 41 41 41 4 45 46 47 47 47 46 51 51 51 46 55 55 55 45 59 60 60 60 59 64 64 64 59 68 68 68 45 72 73 73 73 72 77 77 77 72 81 81 81 4 85 86 87 87 87 86 91 91 91 86 95 95 95 85 99 100 100 100...
output:
2220463353769 2215951597196 2211479570611 2207027382994 2202743405274 2198477622058 2194248890684 2190025368036 2185824499301 2181635711744 2177451161167 2173283009227 2169134890509 2164987146532 2160857395259 2156732560088 2152649988469 2148573802976 2144537516580 2140517717809 2136499544865 213249...
result:
ok 2001 tokens
Test #31:
score: 0
Accepted
time: 14ms
memory: 3944kb
input:
1 2000 1 2 3 4 5 5 5 5 5 4 11 11 11 11 11 4 17 17 17 17 17 4 23 23 23 23 23 4 29 29 29 29 29 3 35 36 36 36 36 36 35 42 42 42 42 42 35 48 48 48 48 48 35 54 54 54 54 54 35 60 60 60 60 60 3 66 67 67 67 67 67 66 73 73 73 73 73 66 79 79 79 79 79 66 85 85 85 85 85 66 91 91 91 91 91 3 97 98 98 98 98 98 97 ...
output:
2208269535286 2201965788211 2195901598301 2190229604124 2184649488162 2179137989697 2173652572269 2168179173332 2162748331593 2157344175929 2152012814201 2146730637520 2141456159679 2136182996484 2130955745539 2125735487974 2120530942766 2115366611519 2110259879509 2105161081005 2100063350152 209499...
result:
ok 2001 tokens
Test #32:
score: 0
Accepted
time: 14ms
memory: 4168kb
input:
1 2000 1 2 3 4 4 4 4 4 4 4 3 12 12 12 12 12 12 12 3 20 20 20 20 20 20 20 3 28 28 28 28 28 28 28 3 36 36 36 36 36 36 36 3 44 44 44 44 44 44 44 3 52 52 52 52 52 52 52 2 60 61 61 61 61 61 61 61 60 69 69 69 69 69 69 69 60 77 77 77 77 77 77 77 60 85 85 85 85 85 85 85 60 93 93 93 93 93 93 93 60 101 101 10...
output:
2211613093937 2203873815030 2197135664022 2190402844206 2183684810573 2177018722021 2170391914488 2163774359983 2157178275641 2150590622352 2144027020598 2137481265357 2130975419032 2124501985693 2118064876788 2111700229076 2105390706906 2099111683954 2092856084432 2086612024550 2080387049121 207418...
result:
ok 2001 tokens
Test #33:
score: 0
Accepted
time: 14ms
memory: 3936kb
input:
1 2000 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 2 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 2 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 2 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 2...
output:
2196959401867 2182031264244 2167354518175 2152764273075 2138183727470 2123788982503 2109792164872 2096074387680 2082425849765 2068931851585 2055472419921 2042033879883 2028611792780 2015215613680 2001912371298 1988636902283 1975443855432 1962278793316 1949152665681 1936059338016 1922994659296 191002...
result:
ok 2001 tokens
Test #34:
score: 0
Accepted
time: 15ms
memory: 4204kb
input:
1 2000 1 2 3 4 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
2171630160674 2165530712974 2162556071327 2159600602377 2156646652669 2153708243975 2150802039135 2147905381985 2145016131322 2142127220622 2139244428636 2136363734936 2133485911813 2130612743596 2127747010387 2124881477461 2122026241445 2119182496792 2116340431193 2113502159317 2110670762220 210784...
result:
ok 2001 tokens
Test #35:
score: 0
Accepted
time: 14ms
memory: 4076kb
input:
1 2000 1 2 3 4 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 40 1 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 1 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
2215940241599 2190010765248 2187047239647 2184124077088 2181206386910 2178293219747 2175384352798 2172487248664 2169599259451 2166714931562 2163832691106 2160954115304 2158091271663 2155241442460 2152394754456 2149548194450 2146717556894 2143897307485 2141096892310 2138296697532 2135498673546 213271...
result:
ok 2001 tokens
Test #36:
score: 0
Accepted
time: 14ms
memory: 4228kb
input:
1 2000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 1 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 1 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1 102...
output:
2218808669025 2159578545822 2156602623403 2153627141990 2150712155243 2147811589300 2144930742075 2142052890517 2139176889039 2136301386791 2133431975342 2130565778129 2127703605242 2124841606216 2121982256245 2119123929584 2116275107292 2113430304295 2110586528521 2107745870238 2104906006598 210206...
result:
ok 2001 tokens
Test #37:
score: 0
Accepted
time: 15ms
memory: 3936kb
input:
1 2000 1 2 3 4 1 6 7 8 1 10 11 12 1 14 15 16 1 18 19 20 1 22 23 24 1 26 27 28 1 30 31 32 1 34 35 36 1 38 39 40 1 42 43 44 1 46 47 48 1 50 51 52 1 54 55 56 1 58 59 60 1 62 63 64 1 66 67 68 1 70 71 72 1 74 75 76 1 78 79 80 1 82 83 84 1 86 87 88 1 90 91 92 1 94 95 96 1 98 99 100 1 102 103 104 1 106 107...
output:
2209574190497 1933931644830 1930994920629 1928074341500 1925157523334 1922276902938 1919399749996 1916543815821 1913692915943 1910862408568 1908042971091 1905228920202 1902421409198 1899614464723 1896810877285 1894009742256 1891226514166 1888447910846 1885672677940 1882901192651 1880138128305 187737...
result:
ok 2001 tokens
Test #38:
score: 0
Accepted
time: 10ms
memory: 4036kb
input:
1 2000 1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 11...
output:
2173172493533 1624614046718 1622616800636 1620622084341 1618631413337 1616644958165 1614659559149 1612674532205 1610691771393 1608717316873 1606744179849 1604772769349 1602801918033 1600840621087 1598880672621 1596921472937 1594963177445 1593005197293 1591047741123 1589090353193 1587134426943 158517...
result:
ok 2001 tokens