QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#457753 | #8831. Chemistry Class | ucup-team180# | AC ✓ | 114ms | 29616kb | C++17 | 35.5kb | 2024-06-29 13:54:55 | 2024-06-29 13:54:56 |
Judging History
answer
#pragma region Macros
#ifdef noimi
#pragma comment(linker, "/stack:256000000")
#include "my_template.hpp"
#else
// #pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#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 <immintrin.h>
#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 <utility>
#include <variant>
#ifdef noimi
#define oj_local(a, b) b
#else
#define oj_local(a, b) a
#endif
#define LOCAL if(oj_local(0, 1))
#define OJ if(oj_local(1, 0))
using namespace std;
using ll = long long;
using ull = unsigned long long int;
using i128 = __int128_t;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vc<T>>;
template <typename T> using vvvc = vector<vvc<T>>;
using vi = vc<int>;
using vl = vc<ll>;
using vpi = vc<pii>;
using vpl = vc<pll>;
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
template <typename T> int si(const T &x) { return x.size(); }
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); }
vi iota(int n) {
vi a(n);
return iota(a.begin(), a.end(), 0), a;
}
template <typename T> vi iota(const vector<T> &a, bool greater = false) {
vi res(a.size());
iota(res.begin(), res.end(), 0);
sort(res.begin(), res.end(), [&](int i, int j) {
if(greater) return a[i] > a[j];
return a[i] < a[j];
});
return res;
}
// macros
#define overload5(a, b, c, d, e, name, ...) name
#define overload4(a, b, c, d, name, ...) name
#define endl '\n'
#define REP0(n) for(ll jidlsjf = 0; jidlsjf < n; ++jidlsjf)
#define REP1(i, n) for(ll i = 0; i < (n); ++i)
#define REP2(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP3(i, a, b, c) for(ll i = (a); i < (b); i += (c))
#define rep(...) overload4(__VA_ARGS__, REP3, REP2, REP1, REP0)(__VA_ARGS__)
#define per0(n) for(int jidlsjf = 0; jidlsjf < (n); ++jidlsjf)
#define per1(i, n) for(ll i = (n)-1; i >= 0; --i)
#define per2(i, a, b) for(ll i = (a)-1; i >= b; --i)
#define per3(i, a, b, c) for(ll i = (a)-1; i >= (b); i -= (c))
#define per(...) overload4(__VA_ARGS__, per3, per2, per1, per0)(__VA_ARGS__)
#define fore0(a) rep(a.size())
#define fore1(i, a) for(auto &&i : a)
#define fore2(a, b, v) for(auto &&[a, b] : v)
#define fore3(a, b, c, v) for(auto &&[a, b, c] : v)
#define fore4(a, b, c, d, v) for(auto &&[a, b, c, d] : v)
#define fore(...) overload5(__VA_ARGS__, fore4, fore3, fore2, fore1, fore0)(__VA_ARGS__)
#define setbits(j, n) for(ll iiiii = (n), j = lowbit(iiiii); iiiii; iiiii ^= 1 << j, j = lowbit(iiiii))
#define perm(v) for(bool permrepflag = true; (permrepflag ? exchange(permrepflag, false) : next_permutation(all(v)));)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define drop(s) cout << #s << endl, exit(0)
#define si(c) (int)(c).size()
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define lbg(c, x) distance((c).begin(), lower_bound(all(c), (x), greater{}))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define ubg(c, x) distance((c).begin(), upper_bound(all(c), (x), greater{}))
#define rng(v, l, r) v.begin() + (l), v.begin() + (r)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define SORT(v) sort(all(v))
#define REV(v) reverse(all(v))
#define UNIQUE(x) SORT(x), x.erase(unique(all(x)), x.end())
template <typename T = ll, typename S> T SUM(const S &v) { return accumulate(all(v), T(0)); }
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#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__))))
constexpr pii dx4[4] = {pii{1, 0}, pii{0, 1}, pii{-1, 0}, pii{0, -1}};
constexpr pii dx8[8] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};
namespace yesno_impl {
const string YESNO[2] = {"NO", "YES"};
const string YesNo[2] = {"No", "Yes"};
const string yesno[2] = {"no", "yes"};
const string firstsecond[2] = {"second", "first"};
const string FirstSecond[2] = {"Second", "First"};
const string possiblestr[2] = {"impossible", "possible"};
const string Possiblestr[2] = {"Impossible", "Possible"};
void YES(bool t = 1) { cout << YESNO[t] << endl; }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { cout << YesNo[t] << endl; }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { cout << yesno[t] << endl; }
void no(bool t = 1) { yes(!t); }
void first(bool t = 1) { cout << firstsecond[t] << endl; }
void First(bool t = 1) { cout << FirstSecond[t] << endl; }
void possible(bool t = 1) { cout << possiblestr[t] << endl; }
void Possible(bool t = 1) { cout << Possiblestr[t] << endl; }
}; // namespace yesno_impl
using namespace yesno_impl;
#define INT(...) \
int __VA_ARGS__; \
IN(__VA_ARGS__)
#define INTd(...) \
int __VA_ARGS__; \
IN2(__VA_ARGS__)
#define LL(...) \
ll __VA_ARGS__; \
IN(__VA_ARGS__)
#define LLd(...) \
ll __VA_ARGS__; \
IN2(__VA_ARGS__)
#define STR(...) \
string __VA_ARGS__; \
IN(__VA_ARGS__)
#define CHR(...) \
char __VA_ARGS__; \
IN(__VA_ARGS__)
#define DBL(...) \
double __VA_ARGS__; \
IN(__VA_ARGS__)
#define VEC(type, name, size) \
vector<type> name(size); \
IN(name)
#define VECd(type, name, size) \
vector<type> name(size); \
IN2(name)
#define VEC2(type, name1, name2, size) \
vector<type> name1(size), name2(size); \
for(int i = 0; i < size; i++) IN(name1[i], name2[i])
#define VEC2d(type, name1, name2, size) \
vector<type> name1(size), name2(size); \
for(int i = 0; i < size; i++) IN2(name1[i], name2[i])
#define VEC3(type, name1, name2, name3, size) \
vector<type> name1(size), name2(size), name3(size); \
for(int i = 0; i < size; i++) IN(name1[i], name2[i], name3[i])
#define VEC3d(type, name1, name2, name3, size) \
vector<type> name1(size), name2(size), name3(size); \
for(int i = 0; i < size; i++) IN2(name1[i], name2[i], name3[i])
#define VEC4(type, name1, name2, name3, name4, size) \
vector<type> name1(size), name2(size), name3(size), name4(size); \
for(int i = 0; i < size; i++) IN(name1[i], name2[i], name3[i], name4[i]);
#define VEC4d(type, name1, name2, name3, name4, size) \
vector<type> name1(size), name2(size), name3(size), name4(size); \
for(int i = 0; i < size; i++) IN2(name1[i], name2[i], name3[i], name4[i]);
#define VV(type, name, h, w) \
vector<vector<type>> name(h, vector<type>(w)); \
IN(name)
#define VVd(type, name, h, w) \
vector<vector<type>> name(h, vector<type>(w)); \
IN2(name)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(string &a) { cin >> a; }
template <class T, class S> void scan(pair<T, S> &p) { scan(p.first), scan(p.second); }
template <class T> void scan(vector<T> &);
template <class T> void scan(vector<T> &a) {
for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
void IN2() {}
template <class Head, class... Tail> void IN(Head &head, Tail &...tail) {
scan(head);
IN(tail...);
}
template <class Head, class... Tail> void IN2(Head &head, Tail &...tail) {
scan(head);
--head;
IN2(tail...);
}
template <int p = -1> void pat() {}
template <int p = -1, class Head, class... Tail> void pat(Head &h, Tail &...tail) {
h += p;
pat<p>(tail...);
}
template <typename T, typename S> T ceil(T x, S y) {
assert(y);
return (y < 0 ? ceil(-x, -y) : (x > 0 ? (x + y - 1) / y : x / y));
}
template <typename T, typename S> T floor(T x, S y) {
assert(y);
return (y < 0 ? floor(-x, -y) : (x > 0 ? x / y : x / y - (x % y == 0 ? 0 : 1)));
}
template <typename T, typename S, typename U> U bigmul(const T &x, const S &y, const U &lim) { // clamp(x * y, -lim, lim)
if(x < 0 and y < 0) return bigmul(-x, -y, lim);
if(x < 0) return -bigmul(-x, y, lim);
if(y < 0) return -bigmul(x, -y, lim);
return y == 0 or x <= lim / y ? x * y : lim;
}
template <class T> T POW(T x, int n) {
T res = 1;
for(; n; n >>= 1, x *= x)
if(n & 1) res *= x;
return res;
}
template <class T, class S> T POW(T x, S n, const ll &mod) {
T res = 1;
x %= mod;
for(; n; n >>= 1, x = x * x % mod)
if(n & 1) res = res * x % mod;
return res;
}
vector<pll> factor(ll x) {
vector<pll> ans;
for(ll i = 2; i * i <= x; i++)
if(x % i == 0) {
ans.push_back({i, 1});
while((x /= i) % i == 0) ans.back().second++;
}
if(x != 1) ans.push_back({x, 1});
return ans;
}
template <class T> vector<T> divisor(T x) {
vector<T> ans;
for(T i = 1; i * i <= x; i++)
if(x % i == 0) {
ans.pb(i);
if(i * i != x) ans.pb(x / i);
}
return ans;
}
template <typename T> void zip(vector<T> &x) {
vector<T> y = x;
UNIQUE(y);
for(int i = 0; i < x.size(); ++i) { x[i] = lb(y, x[i]); }
}
template <class S> void fold_in(vector<S> &v) {}
template <typename Head, typename... Tail, class S> void fold_in(vector<S> &v, Head &&a, Tail &&...tail) {
for(auto e : a) v.emplace_back(e);
fold_in(v, tail...);
}
template <class S> void renumber(vector<S> &v) {}
template <typename Head, typename... Tail, class S> void renumber(vector<S> &v, Head &&a, Tail &&...tail) {
for(auto &&e : a) e = lb(v, e);
renumber(v, tail...);
}
template <class S, class... Args> vector<S> zip(vector<S> &head, Args &&...args) {
vector<S> v;
fold_in(v, head, args...);
sort(all(v)), v.erase(unique(all(v)), v.end());
renumber(v, head, args...);
return v;
}
template <typename S> void rearrange(const vector<S> &id) {}
template <typename S, typename T> void rearrange_exec(const vector<S> &id, vector<T> &v) {
vector<T> w(v.size());
rep(i, si(id)) w[i] = v[id[i]];
v.swap(w);
}
// 並び替える順番, 並び替える vector 達
template <typename S, typename Head, typename... Tail> void rearrange(const vector<S> &id, Head &a, Tail &...tail) {
rearrange_exec(id, a);
rearrange(id, tail...);
}
template <typename T> vector<T> RUI(const vector<T> &v) {
vector<T> res(v.size() + 1);
for(int i = 0; i < v.size(); i++) res[i + 1] = res[i] + v[i];
return res;
}
template <typename T> void zeta_supersetsum(vector<T> &f) {
int n = f.size();
for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b] += f[b | i];
}
template <typename T> void zeta_subsetsum(vector<T> &f) {
int n = f.size();
for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b | i] += f[b];
}
template <typename T> void mobius_subset(vector<T> &f) {
int n = f.size();
for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b] -= f[b | i];
}
template <typename T> void mobius_superset(vector<T> &f) {
int n = f.size();
for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b | i] -= f[b];
}
// 反時計周りに 90 度回転
template <typename T> void rot(vector<vector<T>> &v) {
if(empty(v)) return;
int n = v.size(), m = v[0].size();
vector<vector<T>> res(m, vector<T>(n));
rep(i, n) rep(j, m) res[m - 1 - j][i] = v[i][j];
v.swap(res);
}
vector<int> counter(const vector<int> &v, int max_num = -1) {
if(max_num == -1) max_num = MAX(v);
vector<int> res(max_num + 1);
fore(e, v) res[e]++;
return res;
}
// x in [l, r)
template <class T, class S> bool inc(const T &x, const S &l, const S &r) { return l <= x and x < r; }
template <class T, class S> bool inc(const T &x, const pair<S, S> &p) { return p.first <= x and x < p.second; }
// 便利関数
constexpr ll ten(int n) { return n == 0 ? 1 : ten(n - 1) * 10; }
constexpr ll tri(ll n) { return n * (n + 1) / 2; }
// l + ... + r
constexpr ll tri(ll l, ll r) { return (l + r) * (r - l + 1) / 2; }
ll max(int x, ll y) { return max((ll)x, y); }
ll max(ll x, int y) { return max(x, (ll)y); }
int min(int x, ll y) { return min((ll)x, y); }
int min(ll x, int y) { return min(x, (ll)y); }
// bit 演算系
#define bit(i) (1LL << i) // (1 << i)
#define test(b, i) (b >> i & 1) // b の i bit 目が立っているか
ll pow2(int i) { return 1LL << i; }
int topbit(signed t) { return t == 0 ? -1 : 31 - __builtin_clz(t); }
int topbit(ll t) { return t == 0 ? -1 : 63 - __builtin_clzll(t); }
// int lowbit(signed a) { return a == 0 ? 32 : __builtin_ctz(a); }
int lowbit(ull a) { return a == 0 ? 64 : __builtin_ctzll(a); }
// int allbit(int n) { return (1 << n) - 1; }
constexpr ll mask(int n) { return (1LL << n) - 1; }
// int popcount(signed t) { return __builtin_popcount(t); }
// int popcount(ll t) { return __builtin_popcountll(t); }
int popcount(uint64_t t) { return __builtin_popcountll(t); }
static inline uint64_t popcount64(uint64_t x) {
uint64_t m1 = 0x5555555555555555ll;
uint64_t m2 = 0x3333333333333333ll;
uint64_t m4 = 0x0F0F0F0F0F0F0F0Fll;
uint64_t h01 = 0x0101010101010101ll;
x -= (x >> 1) & m1;
x = (x & m2) + ((x >> 2) & m2);
x = (x + (x >> 4)) & m4;
return (x * h01) >> 56;
}
bool ispow2(int i) { return i && (i & -i) == i; }
ll rnd(ll l, ll r) { //[l, r)
#ifdef noimi
static mt19937_64 gen;
#else
static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
#endif
return uniform_int_distribution<ll>(l, r - 1)(gen);
}
ll rnd(ll n) { return rnd(0, n); }
template <class t> void random_shuffle(vc<t> &a) { rep(i, si(a)) swap(a[i], a[rnd(0, i + 1)]); }
int in() {
int x;
cin >> x;
return x;
}
ll lin() {
unsigned long long x;
cin >> x;
return x;
}
template <class T, class S> pair<T, S> operator-(const pair<T, S> &x) { return pair<T, S>(-x.first, -x.second); }
template <class T, class S> pair<T, S> operator-(const pair<T, S> &x, const pair<T, S> &y) { return pair<T, S>(x.fi - y.fi, x.se - y.se); }
template <class T, class S> pair<T, S> operator+(const pair<T, S> &x, const pair<T, S> &y) { return pair<T, S>(x.fi + y.fi, x.se + y.se); }
template <class T> pair<T, T> operator&(const pair<T, T> &l, const pair<T, T> &r) { return pair<T, T>(max(l.fi, r.fi), min(l.se, r.se)); }
template <class T, class S> pair<T, S> operator+=(pair<T, S> &l, const pair<T, S> &r) { return l = l + r; }
template <class T, class S> pair<T, S> operator-=(pair<T, S> &l, const pair<T, S> &r) { return l = l - r; }
// 開閉
template <class T> bool intersect(const pair<T, T> &l, const pair<T, T> &r) { return (l.se < r.se ? r.fi < l.se : l.fi < r.se); }
template <class T> vector<T> &operator++(vector<T> &v) {
fore(e, v) e++;
return v;
}
template <class T> vector<T> operator++(vector<T> &v, int) {
auto res = v;
fore(e, v) e++;
return res;
}
template <class T> vector<T> &operator--(vector<T> &v) {
fore(e, v) e--;
return v;
}
template <class T> vector<T> operator--(vector<T> &v, int) {
auto res = v;
fore(e, v) e--;
return res;
}
template <class T> void connect(vector<T> &l, const vector<T> &r) { fore(e, r) l.eb(e); }
template <class T> vector<T> operator+(const vector<T> &l, const vector<T> &r) {
vector<T> res(max(si(l), si(r)));
rep(i, si(l)) res[i] += l[i];
rep(i, si(r)) res[i] += r[i];
return res;
}
template <class T> vector<T> operator-(const vector<T> &l, const vector<T> &r) {
vector<T> res(max(si(l), si(r)));
rep(i, si(l)) res[i] += l[i];
rep(i, si(r)) res[i] -= r[i];
return res;
}
template <class T> vector<T> &operator+=(const vector<T> &l, const vector<T> &r) {
if(si(l) < si(r)) l.resize(si(r));
rep(i, si(r)) l[i] += r[i];
return l;
}
template <class T> vector<T> &operator-=(const vector<T> &l, const vector<T> &r) {
if(si(l) < si(r)) l.resize(si(r));
rep(i, si(r)) l[i] -= r[i];
return l;
}
template <class T> vector<T> &operator+=(vector<T> &v, const T &x) {
fore(e, v) e += x;
return v;
}
template <class T> vector<T> &operator-=(vector<T> &v, const T &x) {
fore(e, v) e -= x;
return v;
}
template <typename T> struct edge {
int from, to;
T cost;
int id;
edge(int to, T cost) : from(-1), to(to), cost(cost) {}
edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
edge(int from, int to, T cost, int id) : from(from), to(to), cost(cost), id(id) {}
constexpr bool operator<(const edge<T> &rhs) const noexcept { return cost < rhs.cost; }
edge &operator=(const int &x) {
to = x;
return *this;
}
operator int() const { return to; }
friend ostream operator<<(ostream &os, const edge &e) { return os << e.to; }
};
template <typename T> using Edges = vector<edge<T>>;
template <typename T = int> Edges<T> read_edges(int m, bool weighted = false) {
Edges<T> res;
res.reserve(m);
for(int i = 0; i < m; i++) {
int u, v, c = 0;
scan(u), scan(v), u--, v--;
if(weighted) scan(c);
res.eb(u, v, c, i);
}
return res;
}
using Tree = vector<vector<int>>;
using Graph = vector<vector<int>>;
template <class T> using Wgraph = vector<vector<edge<T>>>;
Graph getG(int n, int m = -1, bool directed = false, int margin = 1) {
Tree res(n);
if(m == -1) m = n - 1;
while(m--) {
int a, b;
cin >> a >> b;
a -= margin, b -= margin;
res[a].emplace_back(b);
if(!directed) res[b].emplace_back(a);
}
return res;
}
Graph getTreeFromPar(int n, int margin = 1) {
Graph res(n);
for(int i = 1; i < n; i++) {
int a;
cin >> a;
res[a - margin].emplace_back(i);
}
return res;
}
template <class T> Wgraph<T> getWg(int n, int m = -1, bool directed = false, int margin = 1) {
Wgraph<T> res(n);
if(m == -1) m = n - 1;
while(m--) {
int a, b;
T c;
scan(a), scan(b), scan(c);
a -= margin, b -= margin;
res[a].emplace_back(b, c);
if(!directed) res[b].emplace_back(a, c);
}
return res;
}
void add(Graph &G, int x, int y) { G[x].eb(y), G[y].eb(x); }
template <class S, class T> void add(Wgraph<S> &G, int x, int y, T c) { G[x].eb(y, c), G[y].eb(x, c); }
#define TEST \
INT(testcases); \
while(testcases--)
i128 abs(const i128 &x) { return x > 0 ? x : -x; }
istream &operator>>(istream &is, i128 &v) {
string s;
is >> s;
v = 0;
for(int i = 0; i < (int)s.size(); i++) {
if(isdigit(s[i])) { v = v * 10 + s[i] - '0'; }
}
if(s[0] == '-') { v *= -1; }
return is;
}
ostream &operator<<(ostream &os, const i128 &v) {
if(v == 0) { return (os << "0"); }
i128 num = v;
if(v < 0) {
os << '-';
num = -num;
}
string s;
for(; num > 0; num /= 10) { s.push_back((char)(num % 10) + '0'); }
reverse(s.begin(), s.end());
return (os << s);
}
namespace aux {
template <typename T, unsigned N, unsigned L> struct tp {
static void output(std::ostream &os, const T &v) {
os << std::get<N>(v) << (&os == &cerr ? ", " : " ");
tp<T, N + 1, L>::output(os, v);
}
};
template <typename T, unsigned N> struct tp<T, N, N> {
static void output(std::ostream &os, const T &v) { os << std::get<N>(v); }
};
} // namespace aux
template <typename... Ts> std::ostream &operator<<(std::ostream &os, const std::tuple<Ts...> &t) {
if(&os == &cerr) { os << '('; }
aux::tp<std::tuple<Ts...>, 0, sizeof...(Ts) - 1>::output(os, t);
if(&os == &cerr) { os << ')'; }
return os;
}
template <typename T, typename S, typename U> std::ostream &operator<<(std::ostream &os, const priority_queue<T, S, U> &_pq) {
auto pq = _pq;
vector<T> res;
while(!empty(pq)) res.emplace_back(pq.top()), pq.pop();
return os << res;
}
template <class T, class S> ostream &operator<<(ostream &os, const pair<T, S> &p) {
if(&os == &cerr) { return os << "(" << p.first << ", " << p.second << ")"; }
return os << p.first << " " << p.second;
}
template <class Ch, class Tr, class Container> std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, const Container &x) {
bool f = true;
if(&os == &cerr) os << "[";
for(auto &y : x) {
if(&os == &cerr)
os << (f ? "" : ", ") << y;
else
os << (f ? "" : " ") << y;
f = false;
}
if(&os == &cerr) os << "]";
return os;
}
#define dump(...) static_cast<void>(0)
#define dbg(...) static_cast<void>(0)
void OUT() { cout << endl; }
template <class Head, class... Tail> void OUT(const Head &head, const Tail &...tail) {
cout << head;
if(sizeof...(tail)) cout << ' ';
OUT(tail...);
}
template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
template <class T, class S> constexpr pair<T, S> inf<pair<T, S>> = {inf<T>, inf<S>};
template <class T> void OUT2(const T &t, T INF = inf<T>, T res = -1) { OUT(t != INF ? t : res); }
template <class T> void OUT2(vector<T> &v, T INF = inf<T>, T res = -1) {
fore(e, v) if(e == INF) e = res;
OUT(v);
fore(e, v) if(e == res) e = INF;
}
template <class F> struct REC {
F f;
REC(F &&f_) : f(forward<F>(f_)) {}
template <class... Args> auto operator()(Args &&...args) const { return f(*this, forward<Args>(args)...); }
};
template <class S> vector<pair<S, int>> runLength(const vector<S> &v) {
vector<pair<S, int>> res;
for(auto &e : v) {
if(res.empty() or res.back().fi != e)
res.eb(e, 1);
else
res.back().se++;
}
return res;
}
vector<pair<char, int>> runLength(const string &v) {
vector<pair<char, int>> res;
for(auto &e : v) {
if(res.empty() or res.back().fi != e)
res.eb(e, 1);
else
res.back().se++;
}
return res;
}
struct string_converter {
char start = 0;
char type(const char &c) const { return (islower(c) ? 'a' : isupper(c) ? 'A' : isdigit(c) ? '0' : 0); }
int convert(const char &c) {
if(!start) start = type(c);
return c - start;
}
int convert(const char &c, const string &chars) { return chars.find(c); }
template <typename T> auto convert(const T &v) {
vector<decltype(convert(v[0]))> ret;
ret.reserve(size(v));
for(auto &&e : v) ret.emplace_back(convert(e));
return ret;
}
template <typename T> auto convert(const T &v, const string &chars) {
vector<decltype(convert(v[0], chars))> ret;
ret.reserve(size(v));
for(auto &&e : v) ret.emplace_back(convert(e, chars));
return ret;
}
int operator()(const char &v, char s = 0) {
start = s;
return convert(v);
}
int operator()(const char &v, const string &chars) { return convert(v, chars); }
template <typename T> auto operator()(const T &v, char s = 0) {
start = s;
return convert(v);
}
template <typename T> auto operator()(const T &v, const string &chars) { return convert(v, chars); }
} toint;
template <class T, class F> T bin_search(T ok, T ng, const F &f) {
while(abs(ok - ng) > 1) {
T mid = ok + ng >> 1;
(f(mid) ? ok : ng) = mid;
}
return ok;
}
template <class T, class F> T bin_search_double(T ok, T ng, const F &f, int iter = 80) {
while(iter--) {
T mid = (ok + ng) / 2;
(f(mid) ? ok : ng) = mid;
}
return ok;
}
struct Setup_io {
Setup_io() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cout << fixed << setprecision(11);
}
} setup_io;
#endif
#pragma endregion
namespace segtree_impl {
namespace internal {
// @param n `0 <= n`
// @return minimum non-negative `x` s.t. `n <= 2**x`
int ceil_pow2(int n) {
int x = 0;
while((1U << x) < (unsigned int)(n)) x++;
return x;
}
// @param n `1 <= n`
// @return minimum non-negative `x` s.t. `(n & (1 << x)) != 0`
constexpr int bsf_constexpr(unsigned int n) {
int x = 0;
while(!(n & (1 << x))) x++;
return x;
}
// @param n `1 <= n`
// @return minimum non-negative `x` s.t. `(n & (1 << x)) != 0`
int bsf(unsigned int n) {
#ifdef _MSC_VER
unsigned long index;
_BitScanForward(&index, n);
return index;
#else
return __builtin_ctz(n);
#endif
}
} // namespace internal
} // namespace segtree_impl
namespace segtree_impl {
template <class S, S (*op)(S, S), S (*e)()> struct segtree {
public:
segtree() : segtree(0) {}
explicit segtree(int n) : segtree(std::vector<S>(n, e())) {}
explicit segtree(const std::vector<S> &v) : _n(int(v.size())) {
log = internal::ceil_pow2(_n);
size = 1 << log;
d = std::vector<S>(2 * size, e());
for(int i = 0; i < _n; i++) d[size + i] = v[i];
for(int i = size - 1; i >= 1; i--) { update(i); }
}
void set(int p, S x) {
assert(0 <= p && p < _n);
p += size;
d[p] = x;
for(int i = 1; i <= log; i++) update(p >> i);
}
S get(int p) const {
assert(0 <= p && p < _n);
return d[p + size];
}
S operator[](int k) const { return get(k); }
S prod(int l, int r) const {
#ifdef ONLINE_JUDGE
if(l < 0) l = 0;
if(r > _n) r = _n;
if(l > r) return e();
#endif
assert(0 <= l && l <= r && r <= _n);
S sml = e(), smr = e();
l += size;
r += size;
while(l < r) {
if(l & 1) sml = op(sml, d[l++]);
if(r & 1) smr = op(d[--r], smr);
l >>= 1;
r >>= 1;
}
return op(sml, smr);
}
S all_prod() const { return d[1]; }
template <bool (*f)(S)> int max_right(int l) const {
return max_right(l, [](S x) { return f(x); });
}
template <class F> int max_right(int l, F f) const {
#ifdef ONLINE_JUDGE
if(l < 0) l = 0;
if(l > _n) l = _n;
#endif
assert(0 <= l && l <= _n);
assert(f(e()));
if(l == _n) return _n;
l += size;
S sm = e();
do {
while(l % 2 == 0) l >>= 1;
if(!f(op(sm, d[l]))) {
while(l < size) {
l = (2 * l);
if(f(op(sm, d[l]))) {
sm = op(sm, d[l]);
l++;
}
}
return l - size;
}
sm = op(sm, d[l]);
l++;
} while((l & -l) != l);
return _n;
}
template <bool (*f)(S)> int min_left(int r) const {
return min_left(r, [](S x) { return f(x); });
}
template <class F> int min_left(int r, F f) const {
#ifdef ONLINE_JUDGE
if(r < 0) r = 0;
if(r > _n) r = _n;
#endif
assert(0 <= r && r <= _n);
assert(f(e()));
if(r == 0) return 0;
r += size;
S sm = e();
do {
r--;
while(r > 1 && (r % 2)) r >>= 1;
if(!f(op(d[r], sm))) {
while(r < size) {
r = (2 * r + 1);
if(f(op(d[r], sm))) {
sm = op(d[r], sm);
r--;
}
}
return r + 1 - size;
}
sm = op(d[r], sm);
} while((r & -r) != r);
return 0;
}
friend std::ostream &operator<<(std::ostream &os, segtree &ls) {
os << "{";
for(int i = 0; i < ls._n; i++) os << ls.get(i) << (i == ls._n - 1 ? "" : ", ");
return os << "}";
}
private:
int _n, size, log;
std::vector<S> d;
void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }
};
template <class T> constexpr T inf = std::numeric_limits<T>::max() / 2;
template <class T, class U> constexpr std::pair<T, U> inf<std::pair<T, U>> = {inf<T>, inf<U>};
template <typename T> T min_func(T x, T y) { return min(x, y); }
template <typename T> T max_func(T x, T y) { return max(x, y); }
template <typename T> T plus_func(T x, T y) { return x + y; }
template <typename T, int ID> T set_func(T x, T y) { return (y == ID ? x : y); }
template <typename T> T min_e() { return inf<T>; }
template <typename T> T max_e() { return -inf<T>; }
template <typename T> T plus_e() { return T(); }
template <typename T> using RST = segtree<T, plus_func<T>, plus_e<T>>;
template <typename T> using RmT = segtree<T, min_func<T>, min_e<T>>;
template <typename T> using RMT = segtree<T, max_func<T>, max_e<T>>;
} // namespace segtree_impl
using segtree_impl::RmT;
using segtree_impl::RMT;
using segtree_impl::RST;
using segtree_impl::segtree;
int main() {
TEST {
LL(n, t, s);
VEC(ll, a, n * 2);
SORT(a);
bool flag = true;
rep(i, n) flag &= (a[i * 2] + t >= a[i * 2 + 1]);
if(!flag) {
OUT(-1);
continue;
}
vv(int, p, 2, n * 2);
rep(i, n * 2 - 1) { p[i & 1][i] = (a[i] + s >= a[i + 1]); }
vv(int, P, 2);
rep(i, 2) P[i] = RUI(p[i]);
vv(int, dp, 2, n * 2 + 1, -inf<int>);
dp[0][0] = 0;
vector<RMT<int>> seg(2, RMT<int>(n * 2 + 1));
seg[1].set(1, -P[1][1]);
ll T = t;
dump(P[1]);
rep(i, 2, n * 2 + 1) {
int t = i & 1;
int res = dp[t][i - 2] + (a[i - 2] + s >= a[i - 1]);
dump(i, res);
int l = lb(a, a[i - 1] - T);
chmax(res, seg[t ^ 1].prod(l + 1, i) + P[t ^ 1][i - 1]);
dump(l, res);
dp[t][i] = res;
if(i < n * 2) seg[t ^ 1].set(i + 1, res - P[t ^ 1][i + 1]);
}
OUT(dp[0][n * 2]);
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3884kb
input:
4 1 2 1 42 69 2 3 1 1 2 3 4 2 5 1 6 1 3 4 5 19 1 1 7 8 9 10 11 12 13 14 20
output:
-1 2 1 4
result:
ok 4 number(s): "-1 2 1 4"
Test #2:
score: 0
Accepted
time: 110ms
memory: 29364kb
input:
1 199996 67013419502794 1 403716252634677166 895717933735068492 410002430455111886 844431179242134559 322988383133810700 133475121268220299 481706326769800263 606871141911985391 195911124687409946 959578180866483093 930547702157856949 877914383714875160 994158366044742636 890855755285236186 69498488...
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 99ms
memory: 29616kb
input:
1 199998 38987266278826 1 974183459404323858 517476981059568123 730207399881008603 532509909948600146 89227878552241675 16653300445469756 791674368913652595 92177901403222015 980536748304824579 581564387828767376 471919726893404451 759601909683722004 632340812998214017 818440789777778368 18845836031...
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 109ms
memory: 29544kb
input:
1 199996 54170919220045 1 968843690955781467 596307347951820347 406785475849275444 383666938223357986 725160735782817082 132577412512120631 891899794864087098 779434145671998619 932681297277907326 208765550447928461 385078857912267975 669360937040314510 917331948890514855 505938744714587815 47145437...
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: 0
Accepted
time: 103ms
memory: 29408kb
input:
1 199998 35667463938291 8255384928693 770468016026697053 519790816750772730 110085058423772871 85144239858008037 782003096084947976 938498644167289660 693768718229582367 242186248813489674 155335549252315364 428982852761422230 890445026369869037 86401573937739054 9122788624365829 63351367715811463 1...
output:
193326
result:
ok 1 number(s): "193326"
Test #6:
score: 0
Accepted
time: 64ms
memory: 6256kb
input:
1 199998 30382921668955 14233448082254 963132297376532181 199422464083525159 322744997549904069 484222268324755182 911994852231141516 486452603601138945 442934186247306449 697067018736912231 391585717434570522 682442472054944522 79264788486972294 313368204441969076 399649435615099454 810055146752799...
output:
-1
result:
ok 1 number(s): "-1"
Test #7:
score: 0
Accepted
time: 99ms
memory: 29456kb
input:
1 200000 47927923462269 1 24665586551853470 302052529263706283 210309971053691602 263076256179345770 857799427692929388 314900213613059794 225906274300855842 877882541418616003 513956968201013413 567629150391542269 663560657201049943 575042209033964444 387676442637519091 186961317429366344 950630734...
output:
0
result:
ok 1 number(s): "0"
Test #8:
score: 0
Accepted
time: 113ms
memory: 29540kb
input:
1 199998 61818605050169 1 165409158781561806 460583142448212326 912671218554176848 626926695695102006 33152959806830617 136688663029016820 174877457605065935 419306800362435196 89763241467680808 834116262786866128 830483250820731866 942265949775152349 147293754228427769 117586183977037844 8168200855...
output:
0
result:
ok 1 number(s): "0"
Test #9:
score: 0
Accepted
time: 108ms
memory: 29432kb
input:
1 199996 34451027260033 1 601283108326080907 366774999584049325 421906214352697372 955853417529868631 15724846216041399 237313052425127959 21985568950819605 990795326302503510 838020773207917956 327286028784534617 668754577944547269 293491049615758976 560132287154617049 178505332245992034 5559649986...
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 63ms
memory: 6224kb
input:
1 200000 29187534610932 21950129578571 825099255469982093 186387713027671861 686187988858020000 84398649936510585 404799755268793918 343938261224617536 835021326555656778 414012550526058150 473262296466867769 949711165249895614 876342183912676727 446476677785448323 965973178373470399 211396195851941...
output:
-1
result:
ok 1 number(s): "-1"
Test #11:
score: 0
Accepted
time: 102ms
memory: 29468kb
input:
1 199997 29405605609626 28289738816956 142397526262523706 376764932667952907 458596335650559615 309998508007705361 216906502123233296 997270308488922036 627624046717378857 795390956936077907 455041452649155630 507550903995090795 945772023366794554 886164928026658833 740664590169344757 46022396065308...
output:
199994
result:
ok 1 number(s): "199994"
Test #12:
score: 0
Accepted
time: 114ms
memory: 26992kb
input:
2 53064 111726463850469 1 699764699097067744 693901341124789557 936192127198912674 471397237345629646 57339338518673020 330275460175741176 277844690417194078 346832037195479397 384194477578957186 369530931475729901 783437009257722751 33766787198435970 978743274657154020 728022680382638786 5965748201...
output:
0 0
result:
ok 2 number(s): "0 0"
Test #13:
score: 0
Accepted
time: 83ms
memory: 15460kb
input:
2 86135 126532043457301 1 364939525549488923 331763991963030652 418052566503935602 389200327527950996 223248088765571340 970673647394107710 177103079343576000 220542474217521377 476655819805831981 120317505540454685 584876353613658645 288615905048789050 834361798578942808 23913094970065630 598267059...
output:
0 -1
result:
ok 2 number(s): "0 -1"
Test #14:
score: 0
Accepted
time: 82ms
memory: 16080kb
input:
2 114819 48359228554241 10435302888019 586220278501534443 917827003963097280 562493926325895741 832147339756103774 598789207580673171 30092248715925739 347809122759281987 202961279549277103 26954992614204788 25477890176628825 346240213874791872 935701273590132621 71601416863439116 479976624236884522...
output:
-1 0
result:
ok 2 number(s): "-1 0"
Test #15:
score: 0
Accepted
time: 104ms
memory: 25976kb
input:
2 51745 111115340822721 67934189093410 384004880823650955 20652869941206454 26030297877284505 821820399879575511 900797542879150986 113731242713200216 47022016133737251 798091939356579944 575761259879993980 235315676307469976 172626135747552411 68486068556761355 143910280723620693 60416335438738505 ...
output:
-1 0
result:
ok 2 number(s): "-1 0"
Test #16:
score: 0
Accepted
time: 105ms
memory: 28908kb
input:
2 190655 32089277245186 8619506756687 313636925686617358 451870071979062091 411410323530866491 42956509195506881 447630393674009199 863508035447235453 663740029365028281 533764538570605616 118940275907220185 357308383149237232 441049621449710395 628997155353158776 456432601746051845 8106593168377557...
output:
184083 0
result:
ok 2 number(s): "184083 0"
Test #17:
score: 0
Accepted
time: 103ms
memory: 27180kb
input:
2 50532 206411131207619 1 453908124405692621 462920221744679551 907904756011625936 804821632576418749 93827569616941358 347241015327075451 978208201750742171 834609018152621638 156944026871472980 64996958207346140 686366260594642120 60180419344299670 537873530382922992 170176388394850771 11620871464...
output:
0 0
result:
ok 2 number(s): "0 0"
Test #18:
score: 0
Accepted
time: 110ms
memory: 27600kb
input:
2 48027 120333836960902 1 852731212005209062 641038431282260037 132561713080121959 515369396104032663 719674677958440509 741065267915488017 553188748023480256 631336662948494092 798673521178051212 679314267048932576 944841943701558860 246944235871057242 683112447413388693 475259445129027810 49561621...
output:
0 0
result:
ok 2 number(s): "0 0"
Test #19:
score: 0
Accepted
time: 110ms
memory: 26264kb
input:
2 49149 133285178828754 105395736842425 438730385021926980 353033516195378113 865739746654163321 972190999200412752 103121252277512423 577854906237340101 262738086768730076 380264274946279046 722511171929958464 585388238516141847 65515930476041145 313519865726265646 246858768321542001 31329176568173...
output:
49147 0
result:
ok 2 number(s): "49147 0"
Test #20:
score: 0
Accepted
time: 105ms
memory: 16748kb
input:
2 105395 50078986120418 18340876167195 648281937820433438 261947326564873806 775340723472059206 981294028978258400 672505076534685403 990701863188209735 207121965067693435 577082535084598175 794678100710086611 898694599371396646 463216957702075620 838570651670974795 704470538205573475 77188600378328...
output:
103210 0
result:
ok 2 number(s): "103210 0"
Test #21:
score: 0
Accepted
time: 104ms
memory: 17464kb
input:
2 114532 59348716065946 1 707073926414028020 135039593178301019 936998353144615963 40817963650509678 955840054722887195 637578262041488114 125838856862796599 218263162301917006 702908832064280815 794836944698592827 931716823608350305 381880133001558860 777892097619024781 549655402210414561 907951636...
output:
0 66074
result:
ok 2 number(s): "0 66074"
Test #22:
score: 0
Accepted
time: 91ms
memory: 27228kb
input:
3 509 8687795230109511 1 874419606219949848 805153491719503175 285952137409859859 381199960877552994 577685819318198478 481595434601205925 990498361021007650 28810424367867173 415112651710859761 101880486883721571 262094756535279849 25685369727407668 543952090027824016 248769799722231083 28929310789...
output:
0 0 -1
result:
ok 3 number(s): "0 0 -1"
Test #23:
score: 0
Accepted
time: 75ms
memory: 9380kb
input:
4 25729 263843150705391 1 491550838947319689 460917074245476540 319969923512156280 347939758910402247 234935003049570013 139538312439991103 938469815337154179 153135930050964718 606407473385373897 77576597231426215 964664108861249705 870446742424023567 925472328878405819 99649546101383167 7249250723...
output:
0 -1 -1 0
result:
ok 4 number(s): "0 -1 -1 0"
Test #24:
score: 0
Accepted
time: 104ms
memory: 16048kb
input:
5 7824 645557079670262 1 80319740060576379 902257114558004600 556310632707741861 419577872491566290 701795921206787901 106467831854187382 992427678429308416 678534956735721416 861787907523555581 315209410214369339 662616011051654647 328153871218769095 71251874457531895 522455281421107435 15379240468...
output:
0 0 13573 0 78463
result:
ok 5 number(s): "0 0 13573 0 78463"
Test #25:
score: 0
Accepted
time: 84ms
memory: 14832kb
input:
6 7149 595755394942255 336876686334919 965682703170081996 214427422831972903 573218798849951317 658843399049010933 969188838872744585 508591749087738721 787749323926366685 279746910537782306 756836530142797090 540505521979477156 615521425138729578 461169630014704430 119893359795981508 35894974827370...
output:
7106 -1 -1 -1 73610 35333
result:
ok 6 numbers
Test #26:
score: 0
Accepted
time: 76ms
memory: 9772kb
input:
7 16819 320863505902163 1 344714517404817616 188563574326191698 8515567256960253 543379079483130670 907355032430402423 632866711308714497 172149404648522581 439462059727441010 462446164925946952 426152051217462244 146996734556435803 343664725111360292 498139862692201254 744172815046861183 6614663413...
output:
0 -1 0 40363 0 0 0
result:
ok 7 numbers
Test #27:
score: 0
Accepted
time: 81ms
memory: 9264kb
input:
8 29021 385916515536371 1 815585899245870081 701802878187931277 746329504664167115 632670899688368917 975908301199465872 753145030746489310 81085730043050997 823300028389724881 165191918211637999 72258561923905720 933666487618388570 182398252960194399 600244335291487267 400133338147932369 3472393894...
output:
0 -1 -1 0 -1 0 0 -1
result:
ok 8 numbers
Test #28:
score: 0
Accepted
time: 96ms
memory: 8980kb
input:
9 37136 181297537035873 1 833350010023202701 870378885569799984 742749624865077638 584855847695417201 491119081178402465 16941760736438165 665763377206966428 333854817955377254 845243250208505747 142810782769571050 178378864226694959 86145376271143451 70700909971178524 953613629614431758 72183106198...
output:
0 -1 0 33560 0 -1 0 0 0
result:
ok 9 numbers
Test #29:
score: 0
Accepted
time: 77ms
memory: 7028kb
input:
10 5543 824244699001522 571613447523814 960374413603645090 372265795494869323 157855393051101619 91904466243955025 510545117928562700 992130424389568546 216380470194378947 790239978630243610 467848021057973585 223343367503504904 228256507753893684 197620173785049384 795530519242127812 85545388545704...
output:
5539 0 -1 -1 -1 -1 0 -1 0 0
result:
ok 10 numbers
Test #30:
score: 0
Accepted
time: 95ms
memory: 5040kb
input:
100 2336 3588450315418108 1 43945823274055773 514617468032557350 177210173305151877 224515244330342028 25308395181317136 529900857025400008 200085674181936891 942061137499603772 875836576152554014 157640788957726599 350489650918792106 911699052264635193 439332807718886405 653360193648558682 32877327...
output:
0 160 220 0 1336 0 2060 0 0 8614 -1 1894 1679 -1 0 -1 162 0 2252 0 0 39 1648 -1 538 0 -1 -1 739 0 0 -1 629 0 124 0 0 -1 0 1156 169 -1 1184 0 2307 0 0 -1 0 0 1902 -1 -1 3209 -1 0 0 20 0 751 0 0 285 4681 0 0 0 470 0 -1 -1 194 0 1910 0 11204 1742 0 636 0 -1 0 -1 -1 0 4073 3580 0 0 5380 0 219 0 -1 722 0...
result:
ok 100 numbers
Test #31:
score: 0
Accepted
time: 81ms
memory: 4164kb
input:
101 92 44080773293761828 1 50223092678158559 358494954680967333 100718032274138433 718459507808345619 570829546302958191 943051640828009604 485716202203373032 782650038347005456 120729328342162197 10154653643322162 972303641662189296 246841224277531399 10586357478909740 496584704775961443 2373099292...
output:
0 0 0 2077 0 -1 4494 -1 -1 3461 0 0 -1 2316 0 0 0 5 -1 0 0 0 0 1588 0 0 0 0 1838 1747 4098 659 1023 -1 0 -1 0 -1 3523 2890 0 0 0 0 0 0 0 0 1320 -1 273 -1 -1 883 414 0 122 0 6598 0 0 0 0 264 0 0 0 0 -1 0 0 0 0 -1 0 696 -1 0 0 0 -1 -1 613 0 0 0 -1 0 0 0 -1 482 -1 -1 0 -1 1974 0 0 714 0
result:
ok 101 numbers
Test #32:
score: 0
Accepted
time: 82ms
memory: 4808kb
input:
102 8381 684296342989948 580156570869449 948885747123969809 294293265386179222 153176227758242947 178660132353644160 32526519043258869 697748596881109647 903440483112729565 821349118998550511 801468922734132472 137775877473252795 679112148650313037 240780797320708556 42180935441067387 89820464090814...
output:
-1 0 3730 0 0 0 313 0 0 0 0 0 0 0 0 691 -1 0 0 -1 0 0 0 1386 -1 -1 0 0 0 2627 0 -1 0 -1 -1 368 -1 0 -1 0 0 576 0 2813 1724 5188 0 -1 1113 5038 2289 0 0 0 1234 5369 246 195 0 3272 0 -1 0 0 723 0 0 0 0 24 17 0 1226 -1 -1 1740 -1 2765 0 0 1175 -1 0 0 0 0 0 2783 2070 0 3632 1797 0 -1 0 0 -1 10212 0 3912...
result:
ok 102 numbers
Test #33:
score: 0
Accepted
time: 83ms
memory: 4128kb
input:
103 1976 1855752908524539 302410388388880 67411415443405228 596243848104642684 132644642697979877 736520979359893484 738690789985647485 508572991154996122 196962694931635893 285630132773833131 897590387633507808 897987696530940467 438629785716592900 488340531050546360 586986902941787518 534653563058...
output:
1540 0 596 0 -1 2211 0 0 0 0 0 -1 0 -1 63 -1 0 952 -1 -1 4999 0 -1 1872 0 0 401 -1 0 0 641 0 287 -1 0 0 404 0 0 78 0 0 0 -1 -1 -1 -1 2364 0 0 0 0 582 0 676 3055 -1 0 0 0 -1 742 0 -1 -1 0 -1 -1 0 0 -1 487 -1 0 0 0 -1 0 0 0 0 0 0 651 0 560 -1 -1 -1 0 401 213 0 1642 1701 0 1736 -1 783 0 -1 -1 -1
result:
ok 103 numbers
Test #34:
score: 0
Accepted
time: 87ms
memory: 4192kb
input:
104 3135 1154470643049917 260409797535738 522384412724645617 322281760213336118 977094577847042343 154730945122119900 544351743558088169 769946589064475960 789829941261958165 835465661799775286 559595807760897837 52204481608241138 232518236524336333 966355405491507401 895226310622980557 908651125518...
output:
2638 0 -1 0 0 522 0 -1 310 -1 -1 0 -1 0 -1 983 -1 -1 0 974 -1 -1 0 0 0 -1 0 0 0 0 -1 -1 0 -1 0 0 -1 0 1842 0 1238 0 -1 312 1251 -1 878 -1 -1 0 523 0 0 0 0 618 0 5861 0 0 -1 134 76 4130 859 51 0 -1 0 -1 0 0 0 923 0 3362 -1 2862 4507 -1 0 0 493 5081 2073 76 0 0 700 0 -1 -1 -1 0 0 0 4647 -1 0 161 -1 0 ...
result:
ok 104 numbers
Test #35:
score: 0
Accepted
time: 85ms
memory: 4152kb
input:
105 1344 2969038720906018 2254027277149065 79908352479459837 393422907992654866 752428411397984941 390551586840618881 687333657028695674 619608646235325480 531577672743015609 783391820758107370 307995570547689100 839108891860147650 321473055796328622 784059757239567392 411558529093468019 52916460624...
output:
-1 0 0 -1 0 -1 -1 3737 861 0 0 -1 -1 0 -1 0 2455 0 -1 0 0 -1 0 0 0 0 0 1049 0 0 0 4546 3707 -1 0 -1 177 2283 -1 -1 0 -1 0 0 -1 0 0 0 0 0 0 -1 0 0 746 353 0 -1 2614 0 -1 0 0 2221 0 -1 0 -1 -1 406 1354 -1 0 103 1069 0 -1 0 0 5101 -1 0 0 417 198 4057 2798 2230 0 0 0 0 0 0 1068 6820 0 -1 0 0 0 7357 0 -1...
result:
ok 105 numbers
Test #36:
score: 0
Accepted
time: 83ms
memory: 4452kb
input:
106 767 4719870224601602 4281955192936092 544867992440910806 75308507015009055 523431692096771928 271601146869890006 915602753105782094 812640494366617644 127106618630346802 144856005909889535 1769512903860232 270794671480019904 330598349346442190 61352279867548320 812033360608990654 225105544805372...
output:
-1 0 0 0 -1 0 0 -1 -1 -1 0 -1 6805 96 -1 3287 0 0 699 -1 0 -1 -1 0 0 2196 0 791 0 0 -1 -1 0 -1 0 -1 1880 0 0 0 3058 -1 0 1245 -1 -1 213 304 0 -1 1887 -1 0 0 732 -1 0 -1 0 0 0 -1 1420 0 551 0 0 0 727 0 -1 0 0 -1 -1 0 0 0 -1 -1 0 0 -1 0 0 215 0 0 -1 0 0 0 0 0 3107 0 0 -1 0 0 1133 0 0 1658 0 0
result:
ok 106 numbers
Test #37:
score: 0
Accepted
time: 80ms
memory: 4812kb
input:
107 7473 837142253642112 333364828815426 971573146543836700 904122360908054401 550946786761115417 709385527767603343 343907122245004564 422019005670397902 882033114053578520 554113532466037122 809383681816653892 51756032355149879 497067351798300160 273912397114387243 134548634498595959 8295719156534...
output:
-1 2374 64 7 0 0 228 9543 231 0 959 0 0 0 0 0 7949 -1 3631 0 1075 0 0 0 0 0 0 -1 0 -1 -1 7 0 -1 0 0 0 0 384 -1 0 0 2138 0 0 -1 -1 0 0 0 0 945 0 -1 2300 1438 0 -1 0 0 1725 3861 456 0 2369 537 -1 1033 0 575 2413 0 0 0 -1 0 -1 0 -1 -1 -1 0 0 0 0 0 -1 0 -1 -1 636 -1 2281 1905 -1 -1 -1 0 1307 1849 -1 -1 ...
result:
ok 107 numbers
Test #38:
score: 0
Accepted
time: 70ms
memory: 4152kb
input:
108 2033 3412792897959729 1 812733447714213002 999071928177258482 672292727512589631 272283709836967121 407814250737215613 385894428272245619 316596287216158042 287996873730972634 410192604520021890 721603205872872829 746426606387807761 2841081606892994 757934580272546150 242925667637790760 26862628...
output:
0 0 -1 866 2060 -1 0 577 0 0 0 -1 1457 2593 -1 1287 949 -1 -1 0 -1 3128 4436 2398 0 -1 1183 0 0 0 0 -1 0 -1 0 1108 0 197 0 0 615 1379 -1 -1 -1 0 0 0 -1 -1 -1 0 3214 -1 0 0 0 0 -1 4187 0 0 0 2048 0 0 1009 0 0 0 -1 1270 111 0 0 0 -1 0 -1 0 -1 0 3428 0 -1 -1 813 0 0 0 0 0 -1 0 -1 -1 2524 581 0 1044 213...
result:
ok 108 numbers
Test #39:
score: 0
Accepted
time: 92ms
memory: 4428kb
input:
109 336 8469295125130171 1 319740489755868427 889991247784745915 840650067051970127 208985727742895810 837800143969589612 594874107859595899 526397851206593982 143448506252393087 334419659930381857 206913296640949887 188965232913100403 560228232851282926 385675669263282691 165521368033490138 4761880...
output:
0 0 0 0 0 1082 0 976 -1 0 -1 0 1469 16 -1 1373 0 3032 -1 984 6217 0 0 1227 522 103 -1 -1 0 0 0 -1 -1 26 0 -1 0 -1 0 0 0 307 -1 -1 0 -1 960 1428 6418 5421 0 56 0 547 0 -1 0 3412 4705 -1 0 0 0 -1 0 0 0 0 0 -1 3311 0 0 0 0 819 0 -1 3094 -1 -1 1829 0 915 0 -1 -1 0 -1 0 1226 -1 -1 0 1626 0 0 0 0 0 778 77...
result:
ok 109 numbers
Test #40:
score: 0
Accepted
time: 76ms
memory: 4976kb
input:
110 5785 1172022361605161 1 85264540461778046 858952939256363350 895975337155262921 787970709697971819 780730416714139818 138328527912473991 995006319477879961 522379509374169448 769073715890002083 645940326515291317 574165731952842972 148397243342809725 374467456363690803 180727553334918864 2741666...
output:
0 917 0 528 0 -1 0 0 -1 0 3732 0 0 2382 0 1913 -1 -1 668 2950 0 0 0 0 2342 -1 4926 0 3191 -1 -1 0 0 2428 0 -1 898 0 2939 274 15 0 2071 -1 -1 -1 4062 0 -1 1547 0 0 -1 331 196 0 -1 -1 -1 -1 -1 0 0 -1 0 0 0 0 0 412 1124 -1 300 1483 1270 0 0 0 -1 5829 0 0 0 1046 691 0 -1 1011 -1 0 0 0 -1 1744 0 0 -1 188...
result:
ok 110 numbers
Test #41:
score: 0
Accepted
time: 76ms
memory: 3940kb
input:
1000 1284 3813706842871457 2458485231974066 81205956242317444 355973678680589691 908329284134970366 60288335171773317 139742180895895799 237172248961704515 887044988087072919 31940028476276622 318738737943096966 516077986675311982 52630779495837986 775470621777562153 138146334489352587 5718830415456...
output:
-1 0 202 79 0 36 0 0 60 0 78 0 0 0 0 0 0 94 0 0 0 0 -1 -1 -1 0 372 0 0 0 0 382 0 -1 0 49 0 0 720 -1 0 0 0 -1 0 -1 0 -1 0 0 244 0 -1 0 538 -1 52 0 0 372 -1 0 0 0 0 0 0 0 0 -1 0 -1 0 0 0 0 105 -1 -1 0 -1 129 44 57 84 0 0 0 0 269 -1 0 0 0 59 -1 -1 -1 353 -1 0 0 0 0 0 0 -1 0 1082 0 153 0 0 0 85 0 0 0 -1...
result:
ok 1000 numbers
Test #42:
score: 0
Accepted
time: 76ms
memory: 4180kb
input:
1001 151 44002344799765385 1 667626263334701185 572883014742031927 304262417511562553 839054828942218268 44530466838085761 210479771743163466 384353271446805357 660640427629042266 678713731719132098 583151930126218467 114797156585287912 15091930635933197 10816737236149127 148685504082515378 25983288...
output:
0 0 194 0 369 0 0 0 0 3 112 0 263 0 0 0 -1 0 0 -1 -1 -1 0 0 0 202 0 160 417 14 0 -1 301 -1 78 0 -1 0 -1 -1 0 75 0 -1 -1 -1 -1 0 0 -1 0 0 0 250 0 0 -1 0 0 0 8 0 -1 0 0 0 0 0 0 0 0 -1 0 495 -1 1 36 0 0 0 0 71 -1 0 7 -1 0 23 0 -1 -1 6 0 174 0 0 603 33 258 0 -1 0 -1 395 0 126 -1 -1 -1 76 69 -1 0 -1 164 ...
result:
ok 1001 numbers
Test #43:
score: 0
Accepted
time: 72ms
memory: 4236kb
input:
1002 182 23082437618095657 1 98979892870878835 279722545593385338 768593941949671303 154080443583542357 27425047285588529 207686461441718281 994024411900143735 644043052340703203 552417072753335709 842781412433161118 774955884467636569 595470964439638942 961892550100866642 796760976574135498 9128119...
output:
0 -1 14 0 -1 177 -1 9 0 -1 0 0 0 -1 0 -1 -1 0 -1 101 0 14 -1 58 17 0 0 -1 -1 -1 0 0 137 0 0 -1 0 15 45 0 -1 0 0 136 0 0 -1 0 -1 133 212 41 183 28 -1 223 -1 -1 0 0 60 0 -1 0 202 0 0 34 0 440 -1 90 0 61 0 0 -1 164 141 0 0 0 0 0 97 0 84 -1 -1 0 39 0 0 96 -1 233 0 0 22 -1 -1 0 0 0 80 0 0 244 391 -1 -1 -...
result:
ok 1002 numbers
Test #44:
score: 0
Accepted
time: 69ms
memory: 3908kb
input:
1003 95 22131371993117565 5230362156417901 813043212315531181 844097801733568955 501681639211257624 169576187694027641 507990642716089481 541031491442657400 498860399025606138 408841246614247015 876880032124648301 818286632208715624 8721438173210349 637180898870924053 827461001727232841 774578718232...
output:
-1 0 118 157 -1 0 0 0 -1 16 0 -1 0 -1 35 0 265 0 0 0 0 -1 0 -1 0 62 0 0 -1 0 -1 0 0 153 0 0 -1 89 -1 117 0 -1 56 0 -1 0 -1 -1 -1 -1 0 0 -1 -1 82 0 49 0 0 0 0 -1 600 0 0 -1 0 -1 0 5 0 -1 0 37 -1 0 40 0 0 0 0 -1 0 0 0 86 0 96 0 0 0 0 0 -1 0 0 -1 0 194 83 -1 -1 2 -1 0 8 0 0 -1 -1 170 0 137 226 -1 44 0 ...
result:
ok 1003 numbers
Test #45:
score: 0
Accepted
time: 72ms
memory: 3984kb
input:
1004 322 8387652247144512 1 5042916539369281 226931917413595905 171593923730938341 488424776931811398 309155178320088158 121736795514588948 24190167119140631 975232981055787699 245761753336524781 125582675235138773 232566065306790722 358006541708768381 479607393504410478 995974645645853149 545029875...
output:
0 219 0 67 -1 49 0 187 -1 0 0 48 0 99 40 0 -1 0 -1 0 0 0 0 0 0 115 63 0 -1 0 0 0 0 0 0 0 0 -1 0 -1 80 167 -1 -1 -1 0 0 0 0 0 32 0 -1 199 -1 0 0 0 0 0 0 -1 0 20 0 453 56 0 603 237 0 155 171 -1 0 225 0 0 0 0 -1 -1 -1 132 -1 -1 0 133 0 0 0 106 0 39 -1 258 0 -1 0 96 0 0 0 0 2 -1 0 298 43 53 0 -1 215 0 -...
result:
ok 1004 numbers
Test #46:
score: 0
Accepted
time: 77ms
memory: 4052kb
input:
1005 508 5510018872640054 2434442918887125 39957926584011849 651489026895695216 112752007448867333 873225946283293862 83981830155904984 980257715418779666 572885788947273809 960819267392437658 487577822331850266 473834917307002146 233634527581053802 857039070769474368 737212254776905022 338476407878...
output:
481 0 -1 54 0 0 117 0 12 0 250 -1 0 -1 0 155 0 7 0 98 7 258 0 0 -1 0 0 0 -1 0 346 -1 -1 -1 0 -1 0 43 0 0 18 68 23 0 0 0 0 0 0 12 0 0 -1 0 320 0 0 -1 0 216 0 0 0 -1 0 -1 0 0 0 518 -1 -1 0 172 0 51 0 0 -1 -1 -1 0 131 80 250 0 0 -1 110 40 0 0 0 0 8 204 0 0 0 0 38 0 -1 18 410 139 255 -1 34 189 0 0 0 -1 ...
result:
ok 1005 numbers
Test #47:
score: 0
Accepted
time: 77ms
memory: 4012kb
input:
1006 308 17101085920043734 1 953860776568147297 937197631336068904 629441177245591950 934718387040094882 166576696574192288 621024317310966416 77775230843639903 528469298373835341 382090113484574000 684791739675195243 48625853946125317 286710644560002078 940639012187594507 229442585291739786 3931375...
output:
0 0 0 -1 258 0 149 -1 -1 0 -1 -1 321 15 55 0 0 340 217 18 0 -1 0 0 -1 552 0 77 20 257 -1 -1 145 0 286 0 0 0 136 0 0 119 382 -1 0 0 0 157 -1 0 0 31 28 -1 84 669 0 426 0 155 0 0 -1 0 -1 -1 262 1053 563 0 0 0 0 0 0 52 0 43 -1 -1 0 -1 0 -1 663 54 0 0 62 0 0 46 805 0 0 430 35 0 -1 0 0 0 0 0 41 -1 0 0 0 0...
result:
ok 1006 numbers
Test #48:
score: 0
Accepted
time: 77ms
memory: 4220kb
input:
1007 353 12806908788162657 1 823333105192635133 606323996104409324 321123386469924483 385569745341567730 583233321337216462 411040886287524000 968306435961211615 710523807765311700 229331642931429413 916841420656327460 81286808960359257 911354723054934903 2587655541509064 525368684129145725 63700727...
output:
0 -1 81 208 0 -1 -1 0 0 0 0 0 117 0 0 530 0 0 0 -1 -1 0 711 0 0 -1 358 0 0 -1 32 343 0 0 0 116 -1 51 0 -1 -1 0 0 0 0 -1 -1 0 0 0 1327 0 0 -1 0 0 0 -1 20 0 -1 305 0 -1 80 0 219 0 0 0 0 69 0 95 100 83 0 69 -1 176 113 0 0 154 0 -1 -1 249 0 0 0 0 0 286 0 -1 26 0 0 -1 0 54 32 -1 -1 24 0 -1 0 0 261 0 0 0 ...
result:
ok 1007 numbers
Test #49:
score: 0
Accepted
time: 73ms
memory: 4184kb
input:
1008 68 23415628028168936 2113707454537823 935126799395478759 817666242812985229 848194501184761471 730836901348330328 301362509170442771 845370864982463624 443162074073923313 332446981798586687 968700068625964581 170786876276854455 285294800212091278 557001425522512694 491762760663740946 9867235921...
output:
-1 71 44 0 10 299 66 0 25 127 0 89 0 -1 0 190 50 157 0 40 -1 -1 0 -1 32 0 3 206 -1 42 171 170 0 255 0 0 0 0 153 -1 0 10 0 173 -1 336 -1 -1 55 0 52 0 -1 0 0 0 0 0 0 0 0 0 7 0 0 0 -1 131 -1 -1 0 -1 120 0 44 0 103 292 0 170 96 75 0 96 475 0 0 195 0 -1 0 0 -1 -1 165 -1 0 199 0 -1 94 0 -1 0 90 -1 0 0 0 -...
result:
ok 1008 numbers
Test #50:
score: 0
Accepted
time: 72ms
memory: 4200kb
input:
1009 157 15229072488021031 12579478403894075 94967208306540210 184324493872575090 768686342582147795 691053665783073031 361698409622676768 967975001764677119 408298103330540488 794309025259142383 75033959942119439 659736790925639937 884747953187443889 974784809409100562 465444157885249166 2343040467...
output:
156 -1 0 0 172 -1 0 33 -1 0 1 0 30 134 0 51 -1 0 0 -1 0 -1 -1 -1 -1 -1 0 -1 -1 0 473 0 -1 0 0 0 0 42 49 0 -1 0 -1 0 165 12 61 50 -1 -1 -1 -1 82 0 -1 0 531 0 -1 57 0 0 0 255 -1 0 0 0 0 0 0 -1 0 0 -1 159 -1 -1 -1 102 0 0 -1 0 -1 48 0 0 0 0 4 0 228 0 145 0 0 0 -1 -1 0 0 96 -1 316 0 36 0 0 0 34 0 0 -1 0...
result:
ok 1009 numbers
Test #51:
score: 0
Accepted
time: 72ms
memory: 4004kb
input:
1010 242 22650393054374036 1 580541009849417686 678853488211754676 986213418880191911 813731758836016122 357048443625763943 771521747651556137 852723483994962577 135887048088094864 953287541375270484 212803785881898856 510004452817592519 775457003270659336 843658538370435232 482454654213988242 69903...
output:
0 0 0 0 0 0 95 215 65 0 0 0 -1 0 -1 175 -1 111 0 148 0 -1 0 21 0 0 46 -1 54 0 0 0 -1 -1 0 0 0 -1 0 0 -1 0 16 -1 0 0 73 141 56 0 0 0 -1 0 281 -1 390 122 0 0 0 -1 373 590 0 -1 0 -1 -1 467 509 -1 -1 -1 309 37 1121 273 0 -1 0 0 0 106 -1 -1 -1 0 109 -1 -1 4 -1 0 -1 238 -1 0 0 0 -1 106 0 0 0 0 -1 0 0 -1 4...
result:
ok 1010 numbers
Test #52:
score: 0
Accepted
time: 72ms
memory: 3908kb
input:
10000 15 134244202338728829 1 204733339794161288 660722809259434203 50105510301552417 555110932724531241 936545051802147327 72263292751184770 134407546313758189 3089335287618521 138918442130112368 410974407999565453 46830702957602635 115809971642654370 426395900479037014 973420331477168526 606688583...
output:
0 0 0 0 0 0 -1 3 -1 -1 0 21 0 -1 0 0 19 23 0 0 0 0 0 0 -1 0 18 0 0 -1 -1 0 1 -1 4 7 28 0 0 0 -1 23 0 -1 33 22 0 0 12 25 -1 0 0 -1 0 12 0 0 0 0 24 0 0 0 -1 0 0 0 8 0 0 0 0 2 0 -1 0 -1 0 -1 0 0 -1 3 19 0 3 10 6 0 -1 0 0 0 0 0 0 0 -1 0 0 -1 -1 0 0 -1 0 0 0 0 -1 20 0 0 0 0 57 16 0 -1 -1 0 0 14 -1 0 0 -1...
result:
ok 10000 numbers
Test #53:
score: 0
Accepted
time: 72ms
memory: 3940kb
input:
10001 19 86707760612269815 64632583236686161 46812466269047507 344580510794068328 770731816059637717 838406792712099451 666417628825001064 798515701245363810 582575620476341204 667705432772775828 79610136689307893 495867859864071389 603070575496307327 816524102953439949 664759482327545359 2176985887...
output:
18 0 0 0 0 0 5 0 17 47 -1 0 0 0 0 0 0 0 0 3 0 40 0 0 0 -1 21 -1 -1 38 23 22 -1 21 0 -1 0 0 -1 0 0 0 2 -1 0 0 -1 -1 11 0 0 -1 24 0 0 101 21 20 0 2 0 0 0 11 -1 0 0 0 1 0 6 0 0 -1 -1 0 8 28 0 0 -1 0 22 3 27 -1 0 10 0 29 4 0 20 7 -1 -1 65 0 0 0 -1 0 0 -1 0 -1 0 0 1 0 -1 0 2 0 0 0 14 23 -1 6 2 42 -1 0 -1...
result:
ok 10001 numbers
Test #54:
score: 0
Accepted
time: 72ms
memory: 3848kb
input:
10002 42 34923714896604115 13986424737842063 486199193350489990 319244704262790579 935904129672895780 144226366466034838 152598200331256989 215400228316925408 380606952272289953 729928450107760087 542932774722391731 518199842671250837 187490726732958670 178435100364480904 735693950996854530 74809482...
output:
28 0 0 0 -1 0 14 -1 0 0 0 1 0 0 -1 0 0 -1 0 0 -1 -1 -1 0 -1 0 2 0 0 0 0 0 0 0 0 7 23 0 4 -1 -1 -1 2 -1 0 16 0 1 0 0 72 1 -1 0 0 0 0 5 -1 0 0 0 0 0 0 26 0 0 0 45 -1 -1 23 0 21 42 7 -1 -1 -1 0 -1 -1 0 0 -1 0 -1 0 -1 6 0 104 0 0 7 -1 2 -1 -1 0 0 0 0 17 0 11 0 0 -1 0 0 0 -1 36 0 0 0 -1 0 -1 10 0 0 0 27 ...
result:
ok 10002 numbers
Test #55:
score: 0
Accepted
time: 72ms
memory: 3836kb
input:
10003 12 91319936521587897 49352755093968593 49971332104787604 433946361918199843 593984338703582947 844749424479033818 647064318699953993 941390947410832030 431706107264477271 929395543181309004 928620511503555302 694012767579181365 677245008507622303 3487705261877502 386171826014492162 50266440218...
output:
-1 0 0 3 0 16 0 3 0 0 -1 0 0 0 3 0 0 0 0 0 24 12 0 0 0 10 0 -1 0 0 -1 -1 0 0 0 4 0 0 0 0 12 0 -1 2 0 -1 40 -1 0 0 -1 0 2 -1 0 14 0 -1 -1 0 24 0 17 -1 -1 -1 0 0 0 0 0 -1 -1 0 0 2 0 0 16 -1 0 -1 -1 -1 0 1 -1 0 0 29 26 0 -1 0 105 25 -1 2 0 0 -1 0 0 -1 0 -1 0 0 -1 55 24 0 0 0 0 11 0 0 0 0 0 23 -1 -1 0 0...
result:
ok 10003 numbers
Test #56:
score: 0
Accepted
time: 72ms
memory: 4152kb
input:
10004 14 126859608264304394 18751885138165991 31426656990209979 471029480796986904 485145285283643751 273421710409027743 969460030722474197 888633695164679213 111067984031562310 459606758789888900 548163246145238199 860434649883742808 238076117026949509 285244020372484421 813668172012587392 62401464...
output:
-1 0 0 0 0 -1 2 0 -1 0 8 0 0 0 4 0 -1 0 0 3 0 0 0 9 0 0 0 -1 12 1 51 -1 39 0 0 15 -1 10 10 -1 25 23 0 6 0 12 0 0 0 8 7 -1 0 12 0 -1 0 0 0 0 0 0 -1 0 -1 0 0 9 8 -1 0 9 7 0 0 0 32 -1 5 -1 0 -1 0 0 -1 0 29 5 0 0 0 0 -1 -1 0 0 0 0 0 0 1 0 0 17 0 0 -1 0 0 4 0 0 -1 -1 0 0 10 0 0 -1 0 0 0 -1 22 -1 -1 -1 0 ...
result:
ok 10004 numbers
Test #57:
score: 0
Accepted
time: 72ms
memory: 3952kb
input:
10005 1 366541291895483096 176837303342356920 724605027655689537 358063735760206433 6 543172604794628078 1 488158949269244681 480363677764407769 190688710026610049 235118998411503382 631556290203085313 611931196612937315 555355151359367130 543233334810720924 448751337395406709 551683723210125825 948...
output:
-1 0 2 2 -1 -1 0 0 0 15 0 0 0 2 0 0 0 0 0 4 0 -1 0 0 0 0 -1 1 5 -1 -1 0 2 0 -1 0 0 0 -1 14 -1 2 0 8 0 10 0 -1 0 -1 0 -1 9 0 0 2 0 0 0 0 -1 0 0 0 -1 28 0 0 0 12 0 9 2 -1 0 0 3 0 37 0 0 10 0 0 0 0 1 15 0 -1 3 0 -1 21 -1 -1 0 5 0 -1 0 0 15 0 5 0 -1 0 0 22 0 3 -1 -1 5 7 -1 -1 57 3 -1 -1 0 0 0 0 0 -1 0 0...
result:
ok 10005 numbers
Test #58:
score: 0
Accepted
time: 69ms
memory: 3880kb
input:
10006 2 354776647308670024 149154041735482707 239751952135249260 163081834531615657 644053162633640925 998829809942310944 12 223782147005417082 1 348829280348654817 278044735030919074 657687653194606857 916740250867010735 15997143374825632 686285187012458064 919011591525178633 567660825426910352 366...
output:
1 0 15 2 24 0 0 -1 0 16 -1 -1 32 0 0 31 0 0 -1 0 0 0 3 -1 0 0 0 0 0 0 38 0 0 37 1 -1 1 0 0 -1 -1 0 0 0 0 18 0 0 -1 50 30 2 -1 0 -1 0 0 1 0 -1 9 -1 0 9 0 -1 0 1 3 13 0 -1 0 5 -1 -1 -1 3 26 -1 37 0 14 0 -1 -1 -1 0 4 0 10 4 1 9 0 0 0 5 0 -1 3 0 -1 -1 -1 -1 0 -1 12 0 10 -1 1 0 0 0 -1 -1 -1 0 0 8 0 -1 -1...
result:
ok 10006 numbers
Test #59:
score: 0
Accepted
time: 73ms
memory: 3936kb
input:
10007 27 46173793663646364 9639824924693062 512969709461996240 738886743173419814 953798270323230518 176203233285711425 689270597617280713 47803188122350202 314305183578269452 681950173478291802 888179025466444432 630849866219606204 286964560170430118 410289907688286455 696145142554734317 8566720085...
output:
-1 -1 0 0 0 7 -1 -1 0 0 13 0 0 0 0 0 -1 15 0 16 0 0 -1 15 0 -1 0 -1 -1 0 0 28 6 0 0 0 0 -1 0 0 45 -1 0 0 0 -1 5 0 0 0 4 0 -1 0 -1 -1 0 0 -1 -1 0 7 -1 55 0 -1 -1 0 -1 8 0 11 0 0 0 0 13 26 9 0 0 11 0 -1 19 6 11 0 5 39 0 0 18 4 0 0 0 3 -1 -1 7 0 18 14 5 0 18 0 0 0 0 0 0 -1 0 -1 -1 -1 0 5 0 0 42 0 0 -1 ...
result:
ok 10007 numbers
Test #60:
score: 0
Accepted
time: 72ms
memory: 3872kb
input:
10008 42 42761189318147353 27434686129888512 368755251587651893 472292009438855745 980437463162986811 825392691074659956 201444737161807152 482442871131851400 564353278114825403 474699688655387319 993838159365565791 800602866283430869 948397946283545176 533193917051353094 789067888361138897 25339772...
output:
-1 0 0 0 0 11 10 -1 0 24 0 0 -1 0 0 0 29 0 0 -1 4 -1 0 -1 0 1 0 0 -1 0 -1 0 0 -1 -1 0 44 33 0 0 -1 0 11 -1 -1 0 20 0 0 0 0 -1 -1 0 2 1 -1 0 0 0 1 0 0 0 2 0 0 3 35 0 0 -1 -1 -1 40 -1 0 0 0 1 0 0 0 0 -1 39 -1 0 0 -1 0 57 0 5 0 0 0 -1 0 0 0 0 0 0 0 0 2 0 -1 10 0 0 0 0 0 -1 7 0 0 0 0 0 0 9 -1 0 0 28 -1 ...
result:
ok 10008 numbers
Test #61:
score: 0
Accepted
time: 68ms
memory: 3832kb
input:
10009 55 66562042911803905 1 702961424141619297 48555808916749617 987875656627600791 398699751107580954 778711128456625272 362987227691293854 377594599332701949 841233809759654155 971103850305936769 1055564117010360 933372164519145771 230045627572088298 920596429654330908 453366143666796159 95759232...
output:
0 -1 0 0 2 -1 4 0 14 0 -1 0 2 1 0 58 0 -1 0 0 0 0 0 0 3 0 0 0 0 0 -1 8 53 3 0 5 -1 0 0 0 -1 14 -1 0 0 -1 -1 0 30 10 0 0 0 -1 0 -1 -1 -1 -1 -1 15 11 2 0 0 0 7 0 -1 0 -1 15 26 -1 0 0 0 0 -1 -1 33 23 0 0 13 -1 0 0 0 0 -1 0 -1 -1 0 0 0 10 -1 1 0 11 0 -1 0 -1 0 -1 0 0 34 0 0 0 0 11 -1 50 10 0 -1 1 -1 0 0...
result:
ok 10009 numbers
Test #62:
score: 0
Accepted
time: 73ms
memory: 3844kb
input:
10010 12 105476571192316557 45310809043406608 94802870094115556 588774340725030293 83531295087730345 821489549917755461 258629816378123369 771094202238382271 362849080618762330 460879146754348962 657570507239131813 276856910440174811 988448235904092449 117463987759633541 566355717946665528 670897233...
output:
-1 -1 0 0 -1 7 -1 23 8 0 0 0 0 0 -1 0 -1 -1 0 24 0 0 -1 0 4 -1 -1 0 46 0 4 0 -1 6 0 0 -1 0 0 23 12 0 0 0 0 0 4 -1 0 0 12 -1 0 0 0 0 0 18 0 0 12 0 6 0 0 14 0 29 0 20 12 0 0 5 -1 -1 19 0 0 5 0 0 0 0 -1 0 9 21 18 0 0 0 0 0 0 46 -1 -1 0 0 -1 18 0 0 0 0 -1 0 0 0 0 0 -1 0 0 0 0 0 0 -1 0 0 -1 0 2 -1 8 0 0 ...
result:
ok 10010 numbers
Test #63:
score: 0
Accepted
time: 75ms
memory: 3628kb
input:
50000 5 312096479340423561 1 634366414159705070 213495322738165160 533829324469598699 131789957281047072 674740181387341298 218039413246537221 561207059932882228 921548523098035527 530750479348336033 86207960291529688 1 198517750260564556 1 868535552620985782 706954348776924546 1 153267154046944618 ...
output:
0 0 0 2 -1 -1 0 0 0 0 0 -1 0 -1 0 3 0 -1 0 0 0 1 1 0 0 -1 2 0 0 -1 0 0 -1 0 -1 -1 0 4 -1 0 0 0 0 -1 2 5 0 0 -1 -1 0 -1 0 -1 1 0 1 0 -1 0 -1 2 0 -1 -1 -1 0 -1 12 -1 3 0 2 0 0 0 0 5 0 0 0 -1 -1 0 0 0 -1 0 -1 0 2 0 0 0 3 0 -1 0 0 -1 0 4 0 3 0 1 0 0 0 4 -1 -1 0 4 0 0 0 0 0 0 -1 0 1 -1 -1 0 2 3 0 8 2 0 0...
result:
ok 50000 numbers
Extra Test:
score: 0
Extra Test Passed