QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#689694 | #9227. Henry the Plumber | maspy | AC ✓ | 1ms | 3928kb | C++23 | 19.6kb | 2024-10-30 18:12:42 | 2024-10-30 18:12:42 |
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_mod_2(int x) { return __builtin_parity(x); }
int popcnt_mod_2(u32 x) { return __builtin_parity(x); }
int popcnt_mod_2(ll x) { return __builtin_parityll(x); }
int popcnt_mod_2(u64 x) { return __builtin_parityll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
template <typename T>
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/geo3d/base.hpp"
template <typename T>
struct Point_3d {
T x, y, z;
Point_3d() = default;
template <typename A, typename B, typename C>
Point_3d(A x, B y, C z) : x(x), y(y), z(z) {}
Point_3d operator+(Point_3d p) const { return {x + p.x, y + p.y, z + p.z}; }
Point_3d operator-(Point_3d p) const { return {x - p.x, y - p.y, z - p.z}; }
Point_3d operator*(T t) const { return {x * t, y * t, z * t}; }
Point_3d operator/(T t) const { return {x / t, y / t, z / t}; }
bool operator==(Point_3d p) const { return x == p.x && y == p.y && z == p.z; }
bool operator!=(Point_3d p) const { return x != p.x || y != p.y || z == p.z; }
Point_3d operator-() const { return {-x, -y, -z}; }
bool is_parallel(Point_3d p) const { return x * p.y == y * p.x && y * p.z == z * p.y && z * p.x == x * p.z; }
T dot(Point_3d other) { return x * other.x + y * other.y + z * other.z; }
double norm() { return sqrt(x * x + y * y + z * z); }
Point_3d cross(Point_3d other) { return Point_3d(y * other.z - z * other.y, z * other.x - x * other.z, x * other.y - y * other.x); }
};
template <typename T>
struct Line_3d {
// a + td
Point_3d<T> a, d;
Line_3d(Point_3d<T> A, Point_3d<T> B) : a(A), d(B - A) { assert(d.dot(d) != 0); }
bool is_parallel(Line_3d<T> other) {
Point_3d<T> n = d.cross(other.d);
return (n.x == T(0) && n.y == T(0) && n.z == T(0));
}
bool contain(Point_3d<T> p) {
p = p - a;
p = p.cross(d);
return (p.x == T(0) && p.y == T(0) && p.z == T(0));
}
};
#line 1 "/home/maspy/compro/library/nt/rational.hpp"
template <typename T = long long, bool REDUCE = true>
struct Rational {
T num, den;
Rational() : num(0), den(1) {}
Rational(T x) : num(x), den(1) {}
Rational(T a, T b, bool coprime = false) : num(a), den(b) {
if (den < 0) num = -num, den = -den;
if (!coprime && REDUCE) reduce();
}
static T gcd(T a, T b) {
a = max(a, -a), b = max(b, -b);
while (b) {
a %= b;
swap(a, b);
}
return a;
}
void reduce() {
if constexpr (!REDUCE) {
return;
} else {
T g = gcd(num, den);
num /= g, den /= g;
}
}
Rational &operator+=(const Rational &p) {
if constexpr (!REDUCE) {
num = num * p.den + p.num * den;
den *= p.den;
return *this;
} else {
T g = (REDUCE ? gcd(den, p.den) : 1);
num = num * (p.den / g) + p.num * (den / g);
den *= p.den / g;
reduce();
return *this;
}
}
Rational &operator-=(const Rational &p) {
if constexpr (!REDUCE) {
num = num * p.den - p.num * den;
den *= p.den;
return *this;
} else {
T g = (REDUCE ? gcd(den, p.den) : 1);
num = num * (p.den / g) - p.num * (den / g);
den *= p.den / g;
reduce();
return *this;
}
}
Rational &operator*=(const Rational &p) {
if constexpr (!REDUCE) {
num = num * p.num;
den = den * p.den;
return *this;
} else {
T g1 = gcd(num, p.den);
T g2 = gcd(den, p.num);
num = (num / g1) * (p.num / g2);
den = (den / g2) * (p.den / g1);
return *this;
}
}
Rational &operator/=(const Rational &p) {
T g1 = (REDUCE ? gcd(num, p.num) : 1);
T g2 = (REDUCE ? gcd(den, p.den) : 1);
num = (num / g1) * (p.den / g2);
den = (den / g2) * (p.num / g1);
if (den < 0) num = -num, den = -den;
return *this;
}
Rational operator-() const { return Rational(-num, den); }
Rational operator+(const Rational &p) const { return Rational(*this) += p; }
Rational operator-(const Rational &p) const { return Rational(*this) -= p; }
Rational operator*(const Rational &p) const { return Rational(*this) *= p; }
Rational operator/(const Rational &p) const { return Rational(*this) /= p; }
bool operator==(const Rational &p) const { return num * p.den == p.num * den; }
bool operator!=(const Rational &p) const { return num * p.den != p.num * den; }
bool operator<(const Rational &p) const { return num * p.den < p.num * den; }
bool operator>(const Rational &p) const { return num * p.den > p.num * den; }
bool operator<=(const Rational &p) const { return num * p.den <= p.num * den; }
bool operator>=(const Rational &p) const { return num * p.den >= p.num * den; }
string to_string() { return std::to_string(num) + "/" + std::to_string(den); }
double to_double() { return double(num) / double(den); }
};
#line 6 "main.cpp"
using P = Point_3d<ll>;
void solve() {
auto get = [&]() -> pair<P, P> {
P p, q;
read(p.x, p.y, p.z, q.x, q.y);
q.z = 0;
return {p, q};
};
auto [A, DA] = get();
auto [B, DB] = get();
if (DA.dot(B - A) == 0 && DB.dot(B - A) == 0) return print(2);
// 以下答えは 3 以上
// 延長線上だと?
// サンプルやさしー
// DA,DBは-1倍してもよいので向きはの問題はない
if (DA.is_parallel(DB)) {
// 答 2 はつぶしたので、違う平面です
// いろいろあるが全部 4 っぽい
return print(4);
}
// 交線があってそこまでは双方から 1 手で行ける
// 適当な点を選んで 90 度にできれば 3, できなければ 4.
// 球と直線が交わるかという話になる
/*
入力が特殊なので
交線は x=x0,y=y0 (z=any) の形になる
*/
using QT = Rational<i128>;
auto [x0, y0] = [&]() -> pair<QT, QT> {
QT a = DA.x;
QT b = DA.y;
QT c = DB.x;
QT d = DB.y;
QT s = DA.dot(A);
QT t = DB.dot(B);
QT x = (s * d - t * b) / (a * d - b * c);
QT y = (a * t - c * s) / (a * d - b * c);
return {x, y};
}();
// もとから交線にのってると、0距離で曲がることになってやばい
// AB を直径とする球面
QT a = QT(A.x + B.x) / QT(2);
QT b = QT(A.y + B.y) / QT(2);
QT c = QT(A.z + B.z) / QT(2);
auto dst = [&](QT x, QT y, QT z) -> QT {
x -= a;
y -= b;
z -= c;
return x * x + y * y + z * z;
};
bool ok = (dst(x0, y0, c) <= dst(A.x, A.y, A.z));
if (dst(x0, y0, c) == dst(A.x, A.y, A.z)) {
if ((A - B).dot(DA) == 0) ok = 0;
if ((A - B).dot(DB) == 0) ok = 0;
}
if (ok) return print(3);
print(4);
}
signed main() {
INT(T);
FOR(T) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3856kb
input:
2 -1 -1 3 1 1 2 2 3 2 2 5 5 1 3 0 7 6 -2 1 -2
output:
4 3
result:
ok 2 number(s): "4 3"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3896kb
input:
100 -13 -5 -7 -19 19 -19 -13 0 -7 15 -20 20 19 -17 18 20 -20 -1 18 -19 -18 15 -14 -19 18 19 -20 6 20 -19 -12 9 1 7 -16 -13 -14 -8 8 -13 -19 16 9 20 -19 19 -18 -11 19 -18 19 20 -8 12 20 -11 -9 18 -19 -18 8 11 -13 12 -18 18 13 8 4 -18 -16 20 17 -19 18 20 -18 -3 20 -19 -17 -20 -5 -18 -19 19 16 15 19 20...
output:
4 4 4 4 4 4 3 4 4 4 3 4 4 3 3 4 3 4 4 4 4 4 4 4 4 4 4 4 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 3 4 3 4 4 4 3 4 4 4 4 4 4 4 3 4 3 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 4 4 3 3 4 3 4 4 4 4 4 4 4 4 4
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
100 20 -9 -19 9 13 -12 14 -18 -17 12 2 -3 -2 2 -19 -8 9 -15 -19 3 -16 -16 -18 2 15 19 17 -6 -10 11 14 -20 -6 -19 7 -17 -8 -1 -7 -15 7 -15 3 2 13 -15 -9 11 15 2 -17 20 13 11 -8 -12 18 16 -18 -17 -17 15 -2 -20 1 8 -6 0 -16 -19 -5 -14 16 -17 10 -7 -16 17 -10 -13 1 1 -13 17 11 -3 -3 -18 4 -17 19 -6 -17 ...
output:
3 4 4 4 3 3 4 3 3 4 4 3 4 4 3 3 4 3 4 4 4 4 3 4 3 4 4 3 3 4 4 4 3 4 3 3 4 3 3 4 3 4 3 4 3 4 3 4 4 3 3 4 3 3 4 3 3 4 4 3 3 4 4 3 4 3 3 4 3 3 3 4 3 4 3 4 3 4 3 4 4 3 3 4 3 4 4 4 4 3 3 3 3 4 3 3 4 4 4 4
result:
ok 100 numbers
Test #4:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
100 10 -9 -13 8 -7 -3 3 -15 -5 11 -14 -20 -17 13 -13 3 20 16 -20 8 -2 -15 -20 8 20 20 -10 15 12 6 4 2 20 14 14 -13 6 -20 -10 20 -18 -15 19 10 9 4 18 -11 -16 -15 20 -11 6 15 -10 -17 -19 -6 -6 8 -19 -19 -18 -11 -9 -6 4 18 11 -5 2 -18 20 0 -12 -10 -18 -17 20 -20 19 19 17 2 -11 -20 2 -16 -19 13 -6 6 -5 ...
output:
4 3 4 3 4 4 3 3 3 4 4 3 3 3 4 4 3 3 3 4 4 4 3 4 3 3 3 3 4 4 3 4 4 3 4 3 3 4 4 3 3 3 4 4 3 4 4 4 4 4 3 4 3 4 4 4 3 4 4 3 4 4 3 3 3 4 3 3 3 3 4 4 4 4 3 4 4 3 4 3 4 3 3 3 4 4 3 4 3 4 4 3 4 3 4 4 3 3 4 4
result:
ok 100 numbers
Test #5:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
100 4 -19 -4 4 18 -15 20 -15 -16 18 -11 -10 -13 -7 14 20 -17 0 6 -20 -12 18 -8 3 -14 20 16 17 10 17 0 19 -17 -11 6 18 -19 -7 13 -13 -17 17 -17 -5 -1 17 -13 19 -10 -12 9 -3 -19 -12 -2 -16 11 13 12 -8 17 12 11 -1 20 13 -14 -5 -4 16 -20 8 -16 16 -3 9 -3 -6 14 -12 16 4 9 -16 -10 -15 -3 -17 -20 -2 20 2 1...
output:
4 4 3 4 3 4 4 4 4 4 3 4 3 4 3 3 4 3 3 4 3 4 3 3 4 4 4 4 4 3 3 4 3 4 3 4 4 4 4 4 3 4 4 4 3 4 4 4 4 4 4 4 4 3 4 4 4 4 4 3 3 3 4 4 4 4 4 3 3 4 3 4 4 4 4 3 4 4 3 4 3 4 3 4 4 4 4 4 4 3 4 3 4 4 4 4 3 4 4 4
result:
ok 100 numbers
Test #6:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
100 -1 -13 -13 -14 -8 -1 -3 15 6 -14 19 -1 -16 -20 -14 -16 12 18 20 17 -19 17 -6 16 13 15 -8 18 16 10 17 20 0 0 -13 -19 -19 15 -14 -14 -11 -16 17 17 18 0 2 -10 20 -5 -8 -16 0 3 12 -19 0 -3 1 -14 -18 3 -12 -14 -15 20 1 17 20 -4 -20 6 20 20 -7 20 1 -9 -13 -4 2 17 -18 11 13 8 16 14 -12 16 -11 12 -20 0 ...
output:
3 4 4 4 3 4 4 4 3 4 4 4 3 4 3 4 3 4 3 3 4 4 3 3 3 4 4 4 3 3 4 4 4 3 4 4 4 4 3 3 4 4 4 4 4 4 3 4 4 3 3 3 4 3 3 4 4 4 3 4 4 3 3 3 3 4 4 4 4 3 3 3 4 4 3 4 3 3 4 3 3 4 3 4 4 3 3 3 4 4 3 3 4 3 3 3 3 3 4 3
result:
ok 100 numbers
Test #7:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
100 -16 0 17 16 16 16 -12 -16 14 12 19 -13 -20 -16 -8 -14 20 14 -6 -20 6 -19 12 18 -2 7 20 -19 3 -20 19 -5 12 -16 -12 -9 -11 0 19 4 11 -20 12 14 -14 -19 16 1 -12 -1 -8 -14 11 -15 2 9 -11 18 4 20 -14 3 -16 -20 -4 11 -16 7 -10 -11 20 16 -19 -10 8 -20 0 13 -17 -8 20 -17 2 14 -2 -17 13 7 -8 -11 -8 -6 -2...
output:
4 3 3 4 4 3 3 4 3 3 3 4 3 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 3 4 4 3 4 3 4 4 4 4 4 4 3 4 3 4 4 4 3 3 3 4 4 4 3 4 4 4 3 4 3 4 4 4 4 4 4 3 3 3 4 3 4 4 4 3 4 4 3 3 4 3 4 3 4 4 3 4 3 4 3 4 3 4 3 3 4 3 4
result:
ok 100 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1 1 -1 1 1 1 1 1 2 -1 1
output:
3
result:
ok 1 number(s): "3"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
100 20 19 -6 18 19 -19 -20 14 19 20 -1 19 -19 6 18 12 -20 19 18 19 4 0 -18 -19 10 -13 12 7 -8 11 -19 -18 -9 -19 -20 18 20 11 18 19 -19 19 8 18 -19 18 -19 -12 -19 20 11 12 9 -15 -2 -12 -12 -4 3 11 -19 9 -10 -18 3 -3 -19 4 20 11 -19 -20 10 -20 -19 17 20 -10 19 18 -17 -20 14 19 20 17 20 -6 -18 -19 9 -1...
output:
4 4 4 4 4 4 3 4 4 3 4 4 4 4 3 4 4 3 4 4 4 4 3 4 4 4 4 3 4 4 3 4 4 3 3 4 4 4 4 4 4 4 4 4 4 3 4 4 3 4 3 4 4 4 4 3 3 4 4 4 3 3 4 4 3 4 3 3 4 3 4 3 4 4 4 4 4 4 4 3 4 4 3 4 4 3 4 4 4 4 4 4 4 4 4 3 4 4 4 4
result:
ok 100 numbers
Test #10:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
100 13 -13 12 5 12 12 20 14 -14 -8 18 -17 -5 -1 -17 -10 9 9 -10 18 13 -17 -1 19 -18 11 1 -2 -17 -18 16 19 -17 -8 6 -14 -1 16 -18 6 4 -14 18 -10 14 13 3 12 -1 -14 -20 1 -11 12 15 20 4 -20 -7 -17 8 -19 1 -9 -10 -19 8 -4 -17 18 6 -14 -12 -12 -5 -12 6 19 -18 -11 -16 -16 -10 15 16 12 18 -9 -17 16 -18 5 -...
output:
4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 4 3 4 3 3 4 4 4 4 4 4 3 3 3 3 3 3 3 3 4 3 4 3 4 4 4 4 4 3 4 3 3 4 4 3 3 3 3 3 4 3 3 3 3 3 3 3 3 3 3 4 4 4 4 3 4 3 4 4 4 4 3 4 4 3 3 3 3 4 4 4 4 3 4 3 4 4 3 4 4 4 4 4
result:
ok 100 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
73 14 -7 7 1 10 -16 -4 11 1 10 -14 -13 -16 1 -8 -6 -12 -10 -2 16 -5 -10 -12 0 -13 15 -10 0 0 -2 19 20 19 17 -9 -14 -20 -15 -20 6 3 19 4 -16 -1 5 -13 11 -16 -1 -19 -20 -17 0 11 -19 -20 -10 2 -3 -9 -15 -18 1 -13 17 -13 -11 1 -13 10 -20 17 8 -1 15 20 1 16 -2 -20 -18 8 0 -11 12 -18 17 0 -10 -4 0 10 9 0 ...
output:
2 2 2 4 2 2 2 2 2 2 2 2 2 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 3 2 2 2 2 2 4 2 2 2 2 2 2 4 3 4 2 2 2 2 2 4 3 2 2 2 4 2 2 2 2 2 4 2 2 3 2 2
result:
ok 73 numbers
Test #12:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
100 -20 -20 10 -1 1 20 20 10 -1 6 15 -19 12 -17 20 -18 20 10 17 15 7 -19 0 -16 13 18 17 -10 11 15 17 13 9 -16 15 -6 -13 14 -13 -20 -19 2 13 -8 13 20 -13 -12 -19 -8 -20 20 4 -11 -11 20 -20 4 10 -10 -12 3 0 12 -17 -14 20 17 12 17 6 -19 7 -11 -20 14 8 -6 17 -13 -12 10 -2 19 20 15 -15 -9 -20 3 4 19 -19 ...
output:
4 3 4 3 3 4 4 3 3 4 4 4 3 4 3 4 3 4 4 4 4 3 4 4 4 4 3 4 4 4 3 4 4 3 3 4 3 3 3 4 4 3 4 4 3 4 4 4 4 3 3 3 4 4 4 4 4 4 4 4 4 4 4 3 4 3 4 4 4 4 4 4 4 3 4 4 4 4 4 4 3 4 4 4 4 3 3 4 4 3 4 3 3 4 4 4 3 4 4 3
result:
ok 100 numbers
Test #13:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
100 3 -20 5 19 -11 18 2 18 17 7 18 -6 -20 20 19 -19 -9 20 13 -6 -15 -13 12 -13 1 20 -1 -5 -9 20 -16 -18 -11 16 3 15 18 2 17 -14 -6 -20 15 17 7 9 2 2 19 -11 8 19 2 20 19 4 -19 4 18 -19 12 -19 19 -12 -5 -10 20 2 13 -16 -8 0 20 13 14 17 12 11 16 -13 6 -19 9 1 13 -18 19 -14 -19 -14 -18 -20 -19 -8 19 5 1...
output:
4 4 4 4 4 4 3 3 3 3 3 3 4 4 3 4 4 4 4 4 3 3 4 3 4 4 4 3 3 3 4 4 4 3 4 4 3 3 4 3 4 4 4 3 4 4 3 3 3 4 3 3 4 4 3 4 3 4 4 4 3 4 4 3 3 3 3 3 4 4 4 4 4 3 3 4 4 3 4 4 3 3 3 3 3 3 4 3 3 3 3 3 3 4 4 3 4 3 3 3
result:
ok 100 numbers
Test #14:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
95 12 1 -16 0 15 0 -9 -5 0 -14 15 -2 7 -18 6 4 -14 -18 -2 15 -5 15 -13 -19 0 -3 6 -10 17 0 20 -16 20 -2 11 -17 -6 -15 -20 20 -5 -17 19 16 -19 5 18 18 20 8 -8 -7 -8 13 0 -14 2 5 -2 0 14 0 9 0 5 20 3 13 0 -7 -9 8 20 -18 18 7 19 12 20 -19 12 5 -8 -18 0 11 -6 -3 14 0 13 9 9 16 0 -19 -7 -11 10 12 -2 1 -1...
output:
4 3 4 4 3 4 4 4 4 4 4 4 4 4 4 4 4 3 3 4 4 4 4 4 4 4 4 4 3 3 4 4 3 4 4 4 4 4 3 3 4 4 3 4 4 4 4 4 4 4 4 4 4 4 2 4 4 3 4 4 4 3 3 3 4 4 4 4 4 4 4 4 3 4 4 4 4 3 3 4 4 4 4 4 4 3 4 3 3 4 4 3 4 4 4
result:
ok 95 numbers
Test #15:
score: 0
Accepted
time: 1ms
memory: 3928kb
input:
100 18 18 -7 -19 -18 16 0 -6 -17 18 -17 7 9 -16 -15 6 -19 4 -13 20 -20 -20 -20 -13 2 16 20 20 -3 -7 -19 19 -6 -18 17 15 -17 -7 -17 -16 -15 15 17 -14 -11 18 -8 0 16 -15 15 20 -20 -15 -12 -19 -20 20 6 -15 20 -19 -20 -10 -6 -20 17 20 14 -10 -20 20 20 10 -16 20 -20 -19 5 8 -16 -20 20 -6 -14 20 20 -20 13...
output:
4 3 3 3 4 3 3 3 3 3 4 3 3 4 3 3 3 3 4 4 3 4 3 3 3 3 3 4 3 4 4 3 4 3 4 4 3 4 4 3 3 4 3 3 3 4 4 4 4 3 3 4 3 4 3 3 4 3 4 4 3 3 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 3 4 4 4 3 3 4 3 3 4 3 3 4 3 3 4 3 3
result:
ok 100 numbers
Test #16:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
100 17 19 -19 -6 20 -5 -14 14 -15 -15 19 16 -20 -14 -19 -20 -15 16 -19 -19 -2 -17 4 15 -19 -6 -10 -11 6 -12 15 -14 -17 12 9 -10 12 3 -17 -19 -7 20 -8 5 11 1 -14 16 20 10 16 -14 -12 -16 -20 -15 1 1 -18 -8 -17 -1 -6 18 0 2 -17 -2 17 15 1 -20 -16 -16 0 -8 19 18 10 -10 14 19 -20 -2 16 -20 -13 16 -9 4 -1...
output:
4 4 4 3 4 4 4 4 3 4 4 3 3 3 4 4 4 4 4 3 3 3 4 3 3 3 4 4 4 4 4 3 3 4 3 3 3 4 4 4 4 3 4 2 4 4 3 4 4 3 4 4 3 4 3 3 4 3 3 4 3 3 4 4 3 4 3 3 4 3 3 4 3 4 4 4 3 4 4 4 4 3 4 4 3 4 4 3 3 3 3 3 3 4 3 3 4 4 4 4
result:
ok 100 numbers
Test #17:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
2 -1 -1 3 1 1 2 2 3 2 2 5 5 1 3 0 7 6 -2 1 -2
output:
4 3
result:
ok 2 number(s): "4 3"
Test #18:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
100 -7 20 16 -9 16 20 -5 -13 -16 -14 -14 -4 17 9 11 -1 14 -7 -4 -7 8 -3 -3 -13 -2 -17 -8 -1 15 1 -11 3 -20 0 -10 0 -19 13 19 4 4 17 1 -5 9 4 -19 1 18 -13 -19 5 -19 15 -10 -8 -20 19 9 18 20 13 20 4 -18 -20 -8 -18 -16 -19 20 -19 -9 -10 17 -13 3 5 7 -20 7 13 -13 -3 -6 -9 -15 17 9 -18 2 14 -19 -12 6 18 ...
output:
3 4 4 3 4 3 4 4 4 3 4 3 4 4 3 3 3 3 4 4 4 3 4 3 3 4 4 3 4 4 4 4 4 4 3 4 4 4 4 3 4 4 4 4 4 4 4 3 3 4 3 4 4 3 4 3 4 3 3 4 4 3 3 3 3 4 4 3 4 3 4 3 4 4 3 4 4 4 3 4 4 4 4 4 4 4 4 3 4 3 4 4 4 3 4 3 4 4 4 3
result:
ok 100 numbers
Test #19:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
100 4 16 -20 -11 -1 14 -20 19 5 18 -18 11 7 2 -19 -14 -10 -13 1 8 -8 -12 11 8 -17 12 17 6 -20 8 -7 2 13 12 0 -13 2 -13 -9 17 -19 19 12 6 17 0 -19 -11 15 -16 19 -17 19 -11 3 -20 2 -20 7 17 8 -13 15 -2 15 -18 0 2 -4 16 -1 -19 -1 15 -17 -15 -18 5 3 10 3 7 -15 -1 -19 -6 -13 -17 2 -10 1 -17 16 -17 -10 -1...
output:
3 4 3 3 4 3 4 3 4 3 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 3 3 4 3 3 4 3 4 4 4 4 4 3 4 3 4 3 4 4 4 4 4 4 4 3 4 4 4 3 4 4 4 3 3 4 4 4 3 3 4 4 4 4 3 4 4 4 4 3 4 4 3 4 3 4 4 3 4 4 4 4 4 3 4 4 4 4 4 4 4 3 3
result:
ok 100 numbers
Test #20:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
100 15 -15 17 -12 17 19 19 -17 -12 -17 -16 -3 7 13 -16 20 8 -3 -15 -11 8 11 7 20 19 14 11 5 19 -18 7 19 11 17 -11 0 8 13 1 -12 -20 -20 2 16 2 20 20 2 -2 16 -7 -11 -6 19 -20 -9 11 15 -7 -13 19 8 -7 -12 -1 8 15 -9 11 17 9 -16 20 16 -15 17 -11 15 8 5 -19 1 -18 -11 19 3 16 -5 7 17 20 -20 17 -16 -6 -20 2...
output:
4 4 3 4 3 3 4 4 4 3 3 4 4 3 4 4 4 3 3 4 4 4 4 3 3 4 3 3 4 4 4 3 3 3 3 3 3 3 3 3 4 3 3 3 4 3 3 3 3 3 3 3 3 4 4 3 4 3 3 3 4 3 3 4 3 3 3 3 4 3 4 3 3 3 3 3 3 4 3 3 3 3 3 3 3 3 4 4 3 4 4 3 3 4 4 3 3 3 3 3
result:
ok 100 numbers
Test #21:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
100 19 15 -13 -6 -14 8 8 17 7 -3 12 20 -16 0 -18 2 11 17 -20 0 12 -20 -2 11 2 -13 6 1 -18 -7 -13 11 18 -3 -19 -15 -1 -17 5 13 14 -14 -14 -4 20 -1 11 -5 7 -12 14 19 -11 16 9 -10 -13 16 4 18 20 19 0 -5 1 -7 -17 1 -12 -4 13 -9 20 -16 17 -20 12 -5 5 9 19 6 -18 -12 12 -11 -12 12 -2 -18 17 4 -18 -7 4 17 4...
output:
3 3 4 4 4 4 4 3 3 2 4 4 3 4 4 3 4 3 3 4 4 3 4 3 3 4 4 4 3 3 3 4 3 3 4 4 3 4 4 3 4 3 4 3 4 4 4 4 3 4 3 4 4 4 3 3 3 4 3 3 4 4 3 4 3 4 4 3 4 4 4 4 3 3 4 3 4 3 3 3 4 4 4 3 3 3 4 4 3 3 3 4 4 4 4 4 3 4 3 4
result:
ok 100 numbers
Test #22:
score: 0
Accepted
time: 1ms
memory: 3892kb
input:
100 20 -13 14 3 20 -16 12 -16 17 -11 20 -14 -2 10 14 -19 -6 -4 18 16 2 -14 2 8 19 7 19 -16 -11 17 17 -8 17 -10 -18 -9 -11 -19 -12 4 9 -18 -9 -11 16 -15 -16 0 -19 10 20 -8 -16 3 -13 -20 13 13 12 -20 -12 20 -2 16 11 16 -14 -12 1 5 -8 -17 3 -16 -10 8 2 -20 2 -18 -14 -19 8 -20 13 -17 16 -19 10 4 12 -10 ...
output:
4 4 4 3 4 4 3 4 3 4 3 4 4 3 3 4 3 3 4 4 3 3 4 3 4 3 4 3 3 4 3 3 3 4 4 4 3 4 4 3 3 4 4 3 3 4 4 4 3 3 3 4 4 4 4 4 3 3 4 4 4 4 3 4 4 4 4 4 4 4 3 4 3 4 4 4 4 3 4 3 3 4 3 4 3 3 4 4 3 4 4 4 3 4 4 3 4 3 3 4
result:
ok 100 numbers
Test #23:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
100 13 -13 -18 -17 9 -3 2 14 12 18 10 3 -19 -13 16 19 -10 9 -2 7 -17 8 -14 -16 1 -1 10 17 -5 -15 -1 -13 3 12 0 -12 15 -14 -7 16 -2 0 -2 -13 11 8 -14 20 15 2 15 5 -4 7 -11 4 14 14 -18 -3 -15 -10 20 11 6 -10 3 -20 -18 15 -14 14 -4 4 13 2 2 -16 15 1 1 20 19 3 7 6 -16 -20 -10 2 -1 -20 -14 -14 -19 1 11 2...
output:
3 4 3 4 4 3 3 3 3 3 3 4 3 2 4 3 3 4 4 4 4 3 4 4 3 4 4 4 4 4 4 4 4 4 4 3 4 4 4 3 4 4 4 3 4 3 4 3 4 3 4 3 3 3 3 3 3 3 4 4 4 4 3 4 4 4 4 3 3 3 3 3 4 4 4 3 3 4 3 4 3 3 4 4 4 4 3 4 3 3 4 3 4 3 4 3 4 4 3 4
result:
ok 100 numbers
Test #24:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
100 -4 18 5 14 14 17 0 13 19 -3 19 16 16 18 -16 -20 -13 -14 -13 -16 -5 2 -10 12 -6 -10 7 9 -19 -2 19 -20 8 -20 -9 -16 -4 -6 -8 0 13 -19 -16 19 9 0 19 -15 -9 12 -14 14 6 -15 17 -8 -19 -1 1 17 10 -11 -17 14 16 3 -15 12 18 -2 4 -12 -5 -18 12 -19 3 13 -9 18 2 19 -16 -18 10 20 -19 20 17 -9 18 13 -19 12 -...
output:
4 3 3 4 3 4 3 4 4 4 4 4 4 3 4 3 3 4 3 3 3 4 4 3 4 4 4 4 4 3 4 3 4 3 3 4 4 4 4 3 3 3 3 4 4 4 3 3 3 4 3 4 3 4 4 3 4 4 4 4 3 3 3 4 4 4 4 3 3 3 3 4 3 4 4 3 4 3 4 4 3 4 4 3 4 4 3 4 4 4 3 4 4 3 4 4 3 3 3 4
result:
ok 100 numbers
Extra Test:
score: 0
Extra Test Passed