QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#104823 | #5662. Distance Calculator | maspy | AC ✓ | 2ms | 3536kb | C++20 | 17.6kb | 2023-05-12 01:30:12 | 2023-05-12 01:30:16 |
Judging History
answer
#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;
template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'000'000'000;
template <>
constexpr ll infty<ll> = ll(infty<int>) * infty<int> * 2;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * infty<ll>;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;
using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;
#define vv(type, name, h, ...) \
vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) \
vector<vector<vector<type>>> name( \
h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...) \
vector<vector<vector<vector<type>>>> name( \
a, vector<vector<vector<type>>>( \
b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))
// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)
#define FOR_subset(t, s) \
for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define stoi stoll
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
template <typename T, typename U>
T ceil(T x, U y) {
return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U>
T floor(T x, U y) {
return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T, typename U>
pair<T, T> divmod(T x, U y) {
T q = floor(x, y);
return {q, x - q * y};
}
template <typename T, typename U>
T SUM(const vector<U> &A) {
T sum = 0;
for (auto &&a: A) sum += a;
return sum;
}
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) \
sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()
template <typename T>
T POP(deque<T> &que) {
T a = que.front();
que.pop_front();
return a;
}
template <typename T>
T POP(pq<T> &que) {
T a = que.top();
que.pop();
return a;
}
template <typename T>
T POP(pqg<T> &que) {
assert(!que.empty());
T a = que.top();
que.pop();
return a;
}
template <typename T>
T POP(vc<T> &que) {
assert(!que.empty());
T a = que.back();
que.pop_back();
return a;
}
template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
if (check_ok) assert(check(ok));
while (abs(ok - ng) > 1) {
auto x = (ng + ok) / 2;
tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
}
return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
FOR(iter) {
double x = (ok + ng) / 2;
tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
}
return (ok + ng) / 2;
}
template <class T, class S>
inline bool chmax(T &a, const S &b) {
return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
return (a > b ? a = b, 1 : 0);
}
// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
vc<int> A(S.size());
FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
return A;
}
template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
int N = A.size();
vector<T> B(N + 1);
FOR(i, N) { B[i + 1] = B[i] + A[i]; }
if (off == 0) B.erase(B.begin());
return B;
}
// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
vector<int> ids(len(A));
iota(all(ids), 0);
sort(all(ids),
[&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
return ids;
}
// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
vc<T> B(len(I));
FOR(i, len(I)) B[i] = A[I[i]];
return B;
}
#endif
#line 1 "library/other/io.hpp"
// based on yosupo's fastio
#include <unistd.h>
namespace fastio {
#define FASTIO
// クラスが read(), print() を持っているかを判定するメタ関数
struct has_write_impl {
template <class T>
static auto check(T &&x) -> decltype(x.write(), std::true_type{});
template <class T>
static auto check(...) -> std::false_type;
};
template <class T>
class has_write : public decltype(has_write_impl::check<T>(std::declval<T>())) {
};
struct has_read_impl {
template <class T>
static auto check(T &&x) -> decltype(x.read(), std::true_type{});
template <class T>
static auto check(...) -> std::false_type;
};
template <class T>
class has_read : public decltype(has_read_impl::check<T>(std::declval<T>())) {};
struct Scanner {
FILE *fp;
char line[(1 << 15) + 1];
size_t st = 0, ed = 0;
void reread() {
memmove(line, line + st, ed - st);
ed -= st;
st = 0;
ed += fread(line + ed, 1, (1 << 15) - ed, fp);
line[ed] = '\0';
}
bool succ() {
while (true) {
if (st == ed) {
reread();
if (st == ed) return false;
}
while (st != ed && isspace(line[st])) st++;
if (st != ed) break;
}
if (ed - st <= 50) {
bool sep = false;
for (size_t i = st; i < ed; i++) {
if (isspace(line[i])) {
sep = true;
break;
}
}
if (!sep) reread();
}
return true;
}
template <class T, enable_if_t<is_same<T, string>::value, int> = 0>
bool read_single(T &ref) {
if (!succ()) return false;
while (true) {
size_t sz = 0;
while (st + sz < ed && !isspace(line[st + sz])) sz++;
ref.append(line + st, sz);
st += sz;
if (!sz || st != ed) break;
reread();
}
return true;
}
template <class T, enable_if_t<is_integral<T>::value, int> = 0>
bool read_single(T &ref) {
if (!succ()) return false;
bool neg = false;
if (line[st] == '-') {
neg = true;
st++;
}
ref = T(0);
while (isdigit(line[st])) { ref = 10 * ref + (line[st++] & 0xf); }
if (neg) ref = -ref;
return true;
}
template <typename T,
typename enable_if<has_read<T>::value>::type * = nullptr>
inline bool read_single(T &x) {
x.read();
return true;
}
bool read_single(double &ref) {
string s;
if (!read_single(s)) return false;
ref = std::stod(s);
return true;
}
bool read_single(char &ref) {
string s;
if (!read_single(s) || s.size() != 1) return false;
ref = s[0];
return true;
}
template <class T>
bool read_single(vector<T> &ref) {
for (auto &d: ref) {
if (!read_single(d)) return false;
}
return true;
}
template <class T, class U>
bool read_single(pair<T, U> &p) {
return (read_single(p.first) && read_single(p.second));
}
template <size_t N = 0, typename T>
void read_single_tuple(T &t) {
if constexpr (N < std::tuple_size<T>::value) {
auto &x = std::get<N>(t);
read_single(x);
read_single_tuple<N + 1>(t);
}
}
template <class... T>
bool read_single(tuple<T...> &tpl) {
read_single_tuple(tpl);
return true;
}
void read() {}
template <class H, class... T>
void read(H &h, T &... t) {
bool f = read_single(h);
assert(f);
read(t...);
}
Scanner(FILE *fp) : fp(fp) {}
};
struct Printer {
Printer(FILE *_fp) : fp(_fp) {}
~Printer() { flush(); }
static constexpr size_t SIZE = 1 << 15;
FILE *fp;
char line[SIZE], small[50];
size_t pos = 0;
void flush() {
fwrite(line, 1, pos, fp);
pos = 0;
}
void write(const char val) {
if (pos == SIZE) flush();
line[pos++] = val;
}
template <class T, enable_if_t<is_integral<T>::value, int> = 0>
void write(T val) {
if (pos > (1 << 15) - 50) flush();
if (val == 0) {
write('0');
return;
}
if (val < 0) {
write('-');
val = -val; // todo min
}
size_t len = 0;
while (val) {
small[len++] = char(0x30 | (val % 10));
val /= 10;
}
for (size_t i = 0; i < len; i++) { line[pos + i] = small[len - 1 - i]; }
pos += len;
}
void write(const string s) {
for (char c: s) write(c);
}
void write(const char *s) {
size_t len = strlen(s);
for (size_t i = 0; i < len; i++) write(s[i]);
}
void write(const double x) {
ostringstream oss;
oss << fixed << setprecision(15) << x;
string s = oss.str();
write(s);
}
void write(const long double x) {
ostringstream oss;
oss << fixed << setprecision(15) << x;
string s = oss.str();
write(s);
}
template <typename T,
typename enable_if<has_write<T>::value>::type * = nullptr>
inline void write(T x) {
x.write();
}
template <class T>
void write(const vector<T> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) write(' ');
write(val[i]);
}
}
template <class T, class U>
void write(const pair<T, U> val) {
write(val.first);
write(' ');
write(val.second);
}
template <size_t N = 0, typename T>
void write_tuple(const T t) {
if constexpr (N < std::tuple_size<T>::value) {
if constexpr (N > 0) { write(' '); }
const auto x = std::get<N>(t);
write(x);
write_tuple<N + 1>(t);
}
}
template <class... T>
bool write(tuple<T...> tpl) {
write_tuple(tpl);
return true;
}
template <class T, size_t S>
void write(const array<T, S> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) write(' ');
write(val[i]);
}
}
void write(i128 val) {
string s;
bool negative = 0;
if (val < 0) {
negative = 1;
val = -val;
}
while (val) {
s += '0' + int(val % 10);
val /= 10;
}
if (negative) s += "-";
reverse(all(s));
if (len(s) == 0) s = "0";
write(s);
}
};
Scanner scanner = Scanner(stdin);
Printer printer = Printer(stdout);
void flush() { printer.flush(); }
void print() { printer.write('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
printer.write(head);
if (sizeof...(Tail)) printer.write(' ');
print(forward<Tail>(tail)...);
}
void read() {}
template <class Head, class... Tail>
void read(Head &head, Tail &... tail) {
scanner.read(head);
read(tail...);
}
} // namespace fastio
using fastio::print;
using fastio::flush;
using fastio::read;
#define INT(...) \
int __VA_ARGS__; \
read(__VA_ARGS__)
#define LL(...) \
ll __VA_ARGS__; \
read(__VA_ARGS__)
#define STR(...) \
string __VA_ARGS__; \
read(__VA_ARGS__)
#define CHAR(...) \
char __VA_ARGS__; \
read(__VA_ARGS__)
#define DBL(...) \
double __VA_ARGS__; \
read(__VA_ARGS__)
#define VEC(type, name, size) \
vector<type> name(size); \
read(name)
#define VV(type, name, h, w) \
vector<vector<type>> name(h, vector<type>(w)); \
read(name)
void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"
#line 2 "library/alg/monoid/add.hpp"
template <typename X>
struct Monoid_Add {
using value_type = X;
static constexpr X op(const X &x, const X &y) noexcept { return x + y; }
static constexpr X inverse(const X &x) noexcept { return -x; }
static constexpr X power(const X &x, ll n) noexcept { return X(n) * x; }
static constexpr X unit() { return X(0); }
static constexpr bool commute = true;
};
#line 3 "library/ds/fenwicktree/fenwicktree.hpp"
template <typename Monoid>
struct FenwickTree {
using G = Monoid;
using E = typename G::value_type;
int n;
vector<E> dat;
E total;
FenwickTree() {}
FenwickTree(int n) { build(n); }
template <typename F>
FenwickTree(int n, F f) {
build(n, f);
}
FenwickTree(const vc<E>& v) { build(v); }
void build(int m) {
n = m;
dat.assign(m, G::unit());
total = G::unit();
}
void build(const vc<E>& v) {
build(len(v), [&](int i) -> E { return v[i]; });
}
template <typename F>
void build(int m, F f) {
n = m;
dat.clear();
dat.reserve(n);
total = G::unit();
FOR(i, n) { dat.eb(f(i)); }
for (int i = 1; i <= n; ++i) {
int j = i + (i & -i);
if (j <= n) dat[j - 1] = G::op(dat[i - 1], dat[j - 1]);
}
total = prefix_sum(m);
}
E prod_all() { return total; }
E sum_all() { return total; }
E sum(int k) { return prefix_sum(k); }
E prod(int k) { return prefix_prod(k); }
E prefix_sum(int k) { return prefix_prod(k); }
E prefix_prod(int k) {
chmin(k, n);
E ret = G::unit();
for (; k > 0; k -= k & -k) ret = G::op(ret, dat[k - 1]);
return ret;
}
E sum(int L, int R) { return prod(L, R); }
E prod(int L, int R) {
chmax(L, 0), chmin(R, n);
if (L == 0) return prefix_prod(R);
assert(0 <= L && L <= R && R <= n);
E pos = G::unit(), neg = G::unit();
while (L < R) { pos = G::op(pos, dat[R - 1]), R -= R & -R; }
while (R < L) { neg = G::op(neg, dat[L - 1]), L -= L & -L; }
return G::op(pos, G::inverse(neg));
}
void add(int k, E x) { multiply(k, x); }
void multiply(int k, E x) {
static_assert(G::commute);
total = G::op(total, x);
for (++k; k <= n; k += k & -k) dat[k - 1] = G::op(dat[k - 1], x);
}
template <class F>
int max_right(const F check) {
assert(check(G::unit()));
int i = 0;
E s = G::unit();
int k = 1;
while (2 * k <= n) k *= 2;
while (k) {
if (i + k - 1 < len(dat)) {
E t = G::op(s, dat[i + k - 1]);
if (check(t)) { i += k, s = t; }
}
k >>= 1;
}
return i;
}
int kth(E k) {
return max_right([&k](E x) -> bool { return x <= k; });
}
};
#line 3 "library/seq/inversion.hpp"
template <typename T, bool SMALL = false>
ll inversion(vc<T> A) {
if (A.empty()) return 0;
if (!SMALL) {
auto key = A;
UNIQUE(key);
for (auto&& x: A) x = LB(key, x);
}
ll ANS = 0;
ll K = MAX(A) + 1;
FenwickTree<Monoid_Add<int>> bit(K);
for (auto&& x: A) {
ANS += bit.sum(x + 1, K);
bit.add(x, 1);
}
return ANS;
}
// i 番目:A_i が先頭になるように rotate したときの転倒数
template <typename T, bool SMALL = false>
vi inversion_rotate(vc<T>& A) {
const int N = len(A);
if (!SMALL) {
auto key = A;
UNIQUE(key);
for (auto&& x: A) x = LB(key, x);
}
ll K = MAX(A) + 1;
ll ANS = 0;
FenwickTree<Monoid_Add<int>> bit(K);
for (auto&& x: A) {
ANS += bit.sum(x + 1, K);
bit.add(x, 1);
}
vi res(N);
FOR(i, N) {
res[i] = ANS;
ll x = A[i];
ANS = ANS + bit.sum(x + 1, K) - bit.prefix_sum(x);
}
return res;
}
// inv[i][j] = inversion A[i:j) であるような (N+1, N+1) テーブル
template <typename T>
vvc<int> all_range_inversion(vc<T>& A) {
int N = len(A);
vv(int, dp, N + 1, N + 1);
FOR_R(L, N + 1) FOR(R, L + 2, N + 1) {
dp[L][R] = dp[L][R - 1] + dp[L + 1][R] - dp[L + 1][R - 1];
if (A[L] > A[R - 1]) ++dp[L][R];
}
return dp;
}
#line 5 "main.cpp"
void solve() {
LL(N);
VEC(int, A, N);
print(inversion(A));
}
signed main() {
INT(T);
FOR(T) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3500kb
input:
5 3 3 1 2 4 4 3 2 1 5 4 1 2 3 5 7 2 6 1 5 4 3 7 10 3 2 1 5 7 6 4 10 8 9
output:
2 6 3 8 9
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
4 5 1 3 5 4 2 5 3 1 2 5 4 3 1 2 3 6 5 3 1 6 2 4
output:
4 3 0 8
result:
ok 4 lines
Test #3:
score: 0
Accepted
time: 2ms
memory: 3432kb
input:
5 6 1 3 2 4 6 5 4 4 1 3 2 5 3 5 4 1 2 6 2 5 3 1 6 4 3 2 1 3
output:
2 4 7 6 1
result:
ok 5 lines
Test #4:
score: 0
Accepted
time: 2ms
memory: 3512kb
input:
6 3 1 3 2 6 3 5 6 1 2 4 5 5 3 1 2 4 6 5 3 4 6 2 1 5 4 5 1 3 2 6 4 1 3 5 2 6
output:
1 8 6 11 7 5
result:
ok 6 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3408kb
input:
6 5 1 4 2 3 5 3 3 1 2 6 4 6 2 3 5 1 6 5 2 3 1 6 4 6 3 2 1 4 5 6 3 3 1 2
output:
2 2 10 7 3 2
result:
ok 6 lines
Test #6:
score: 0
Accepted
time: 2ms
memory: 3432kb
input:
4 6 5 1 3 4 6 2 4 4 2 1 3 5 1 5 4 3 2 4 1 2 3 4
output:
7 4 6 0
result:
ok 4 lines
Test #7:
score: 0
Accepted
time: 2ms
memory: 3440kb
input:
7 4 3 2 1 4 5 1 3 2 4 5 5 3 1 5 2 4 5 2 4 5 1 3 4 1 4 3 2 4 4 3 2 1 3 3 2 1
output:
3 1 4 5 3 6 3
result:
ok 7 lines
Test #8:
score: 0
Accepted
time: 2ms
memory: 3340kb
input:
4 5 3 1 5 4 2 6 1 4 6 5 2 3 4 3 2 1 4 5 2 5 1 4 3
output:
5 7 3 5
result:
ok 4 lines
Test #9:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
11 9 5 2 7 1 8 4 9 3 6 23 11 15 4 2 6 3 14 8 19 22 16 7 23 10 13 17 5 21 20 1 9 12 18 17 14 4 6 17 7 10 16 1 11 3 5 12 13 9 2 15 8 29 5 7 12 9 24 11 18 23 1 16 6 14 21 27 10 28 20 4 2 29 3 19 22 17 15 13 8 26 25 9 4 2 5 1 7 9 8 6 3 15 2 12 6 3 9 15 8 11 1 4 5 14 13 10 7 19 8 9 10 2 13 1 19 4 3 5 14 ...
output:
15 104 69 169 14 45 55 47 38 77 195
result:
ok 11 lines
Test #10:
score: 0
Accepted
time: 1ms
memory: 3468kb
input:
18 21 4 16 21 20 17 10 18 3 13 9 8 15 11 6 12 5 7 1 19 2 14 26 25 3 23 6 17 4 2 1 8 16 18 15 12 14 7 9 13 19 24 26 21 20 5 10 22 11 15 15 4 2 3 11 1 8 5 14 12 7 13 10 6 9 11 10 9 3 5 6 4 7 2 1 11 8 25 3 10 23 15 25 1 19 7 16 24 13 6 22 12 21 4 11 8 20 5 2 14 18 17 9 21 21 3 18 2 20 1 12 16 15 5 6 10...
output:
135 135 45 31 162 111 25 96 107 176 166 186 53 28 285 155 44 152
result:
ok 18 lines
Test #11:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
15 14 10 7 4 12 1 2 9 6 11 13 5 14 8 3 21 9 4 8 20 14 15 18 5 17 11 16 3 2 6 19 7 10 1 12 21 13 14 7 4 14 8 10 12 11 9 2 13 3 6 1 5 19 16 14 2 6 7 5 17 15 12 8 3 9 19 1 11 13 18 4 10 28 28 10 27 11 18 24 17 9 16 2 12 14 23 25 21 13 22 15 20 26 6 1 5 19 4 7 3 8 14 12 1 10 6 13 2 8 14 5 3 7 9 4 11 23 ...
output:
42 104 57 84 244 45 117 31 89 131 24 139 214 69 192
result:
ok 15 lines
Test #12:
score: 0
Accepted
time: 2ms
memory: 3424kb
input:
39 37 16 20 14 32 26 9 21 37 27 25 22 2 10 36 6 29 4 24 17 28 35 18 30 7 19 12 1 13 5 3 33 23 11 15 8 31 34 41 38 3 13 26 16 28 17 29 10 32 15 2 33 35 36 18 14 24 31 12 11 40 25 34 27 9 6 8 19 21 7 23 37 20 4 41 5 1 22 39 30 49 4 9 43 27 2 15 28 39 34 26 24 19 32 30 38 18 44 23 42 35 45 49 21 22 47 ...
output:
358 420 616 574 1474 713 277 1482 981 169 882 1147 330 761 1405 547 990 364 532 445 551 1389 1521 421 742 1151 1535 1592 671 822 1448 1112 1284 326 1125 1506 801 529 220
result:
ok 39 lines
Test #13:
score: 0
Accepted
time: 2ms
memory: 3452kb
input:
30 33 7 2 27 29 23 25 32 4 15 18 26 3 28 5 11 1 19 9 8 16 20 30 13 24 33 12 10 6 21 14 17 22 31 48 47 41 44 34 32 30 4 36 24 45 26 25 8 16 12 6 7 48 38 27 2 37 28 22 14 43 10 13 17 35 1 46 11 40 23 29 21 18 31 19 33 5 42 9 39 3 15 20 73 52 10 59 20 46 6 35 70 55 22 12 3 2 31 7 57 37 42 28 71 64 17 5...
output:
245 658 1253 1371 256 1004 1179 541 436 1066 328 632 421 764 728 465 457 579 883 1126 867 1277 726 845 573 1162 711 1329 1356 653
result:
ok 30 lines
Test #14:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
23 68 4 63 28 23 61 31 3 32 43 24 44 20 54 5 36 19 48 56 11 33 65 46 60 6 52 22 29 30 39 50 47 35 26 14 25 1 8 13 66 64 12 37 15 27 58 53 45 17 68 41 2 21 7 10 55 40 18 42 38 67 34 59 9 57 62 49 16 51 51 26 22 1 15 44 6 8 21 2 45 10 16 41 37 33 19 14 38 9 50 49 17 18 32 48 7 4 13 35 5 31 29 24 39 46...
output:
1063 530 531 686 347 1049 930 361 420 1456 453 810 933 1367 253 854 407 512 490 554 1037 651 1008
result:
ok 23 lines
Test #15:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
23 74 74 24 52 57 62 11 73 43 12 35 7 22 64 44 61 55 36 58 50 42 56 16 26 67 18 46 70 51 68 48 4 49 63 47 39 54 34 28 5 30 19 15 1 32 6 8 21 27 60 25 29 66 69 14 13 20 72 37 10 33 17 31 3 38 45 65 40 41 59 71 2 23 9 53 78 74 13 7 32 50 60 29 56 62 44 46 55 69 22 30 39 68 6 31 11 40 37 35 78 12 26 1 ...
output:
1533 1496 1269 527 1134 480 227 463 274 1289 508 298 937 422 865 271 899 937 478 538 636 1279 915
result:
ok 23 lines
Test #16:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
25 58 48 7 49 42 29 41 17 40 54 34 9 22 55 27 58 25 14 53 38 46 43 4 51 47 3 1 30 35 57 2 31 36 20 32 50 6 39 5 11 10 15 23 52 37 44 21 19 18 16 45 24 28 13 56 8 33 12 26 40 28 14 32 33 22 6 10 39 13 36 24 20 30 23 17 12 18 35 19 15 37 8 1 11 2 7 9 5 31 4 34 38 26 29 40 27 16 3 21 25 59 42 6 31 16 4...
output:
946 419 904 1463 228 263 925 878 349 238 1478 672 530 291 1036 288 301 1461 538 1231 1098 666 1538 913 581
result:
ok 25 lines
Test #17:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
43 81 61 1 36 8 29 43 19 46 77 52 51 73 74 63 33 50 47 16 41 17 64 20 44 13 27 60 35 31 12 26 18 14 40 38 79 6 25 65 42 7 32 37 72 81 10 62 54 78 30 58 56 66 21 80 69 75 55 48 45 11 5 4 53 67 39 76 34 15 59 71 22 57 68 2 3 23 28 70 9 49 24 90 57 74 79 26 41 29 69 54 82 87 77 43 53 25 7 85 55 73 72 1...
output:
1615 2180 1707 2353 1865 1584 2091 1949 1663 1721 2123 2028 2095 2447 1832 2624 2033 2161 1594 2558 2471 2201 2063 1681 1727 2517 1749 1632 2220 2139 2506 1770 1829 2182 2130 2062 2299 2343 1827 1597 2348 2426 2080
result:
ok 43 lines
Test #18:
score: 0
Accepted
time: 1ms
memory: 3492kb
input:
42 97 90 45 36 52 19 93 33 7 80 21 94 59 35 83 55 30 12 34 37 64 27 61 8 54 40 81 53 73 1 31 70 67 49 77 32 76 58 66 92 89 10 26 11 25 84 43 4 79 78 96 75 85 86 6 39 68 2 22 97 24 14 48 9 72 23 57 65 20 44 5 69 74 95 56 15 50 82 13 88 28 3 41 46 62 71 17 18 51 42 38 91 16 29 60 63 87 47 82 5 24 69 1...
output:
2367 1715 2488 2177 2449 1748 2157 2292 2418 2442 2572 2538 1993 1551 2178 1753 2488 2035 1486 1750 1838 2262 2371 1545 2186 1915 2140 1808 1627 2475 2039 1523 2188 1739 1830 2431 1864 1904 2350 1651 1758 1664
result:
ok 42 lines
Test #19:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
47 85 47 36 35 67 17 29 73 81 49 27 33 61 80 14 8 7 3 44 30 26 65 22 42 13 45 62 69 32 50 70 68 31 40 46 11 2 75 25 56 16 55 57 23 59 78 72 77 79 9 51 41 28 37 21 53 58 24 20 83 54 18 64 52 1 6 34 85 10 82 15 63 60 76 38 5 71 4 39 43 84 19 74 12 66 48 100 88 73 45 35 54 57 29 67 13 71 87 95 30 53 93...
output:
1722 2744 1705 2369 1831 1778 2241 1674 1735 1614 1798 2568 2315 2219 2083 2078 2490 1773 2479 1930 2300 1744 2629 1872 1688 1893 2088 1835 1989 2389 2229 2386 1606 1515 1846 2319 1795 2203 2181 1749 2363 1607 1895 2395 1701 1601 2390
result:
ok 47 lines
Test #20:
score: 0
Accepted
time: 2ms
memory: 3416kb
input:
49 98 50 34 49 78 3 90 53 7 40 55 81 72 47 95 2 43 80 48 37 5 65 30 32 71 62 57 73 27 22 10 45 60 35 41 77 66 28 82 97 1 96 16 61 74 26 93 64 79 17 75 31 58 52 21 39 88 86 98 14 70 24 29 20 42 46 56 18 44 9 59 51 69 6 25 91 84 54 12 94 89 67 87 36 4 8 13 33 15 23 63 68 85 92 83 38 76 19 11 89 54 20 ...
output:
2412 1999 2477 2074 2159 2265 2425 2249 1686 2496 2214 1687 1679 1510 2448 1636 1697 1440 1967 1892 2066 1786 2101 1872 1391 2300 2548 1588 2353 2338 1828 2487 1635 1868 1681 1823 2274 1831 2287 1634 1746 2028 2294 1983 2457 1987 1878 1847 1983
result:
ok 49 lines
Test #21:
score: 0
Accepted
time: 2ms
memory: 3424kb
input:
45 82 54 42 2 16 46 66 74 24 13 28 47 40 45 53 39 4 1 34 33 17 5 80 48 11 49 67 52 35 56 55 81 27 10 78 23 63 69 7 60 50 79 32 18 12 6 15 8 29 25 59 61 73 20 68 51 64 14 41 31 30 62 77 43 21 71 38 26 82 9 19 44 22 70 3 72 75 37 58 36 65 76 57 86 20 15 75 37 45 63 82 14 68 2 77 1 7 65 74 57 66 11 79 ...
output:
1466 1784 2247 2107 1854 1751 2414 1618 2391 1996 1809 2352 2506 1951 2187 2693 2150 1690 2569 1760 1983 2298 1739 1917 1784 1609 2445 1433 2091 1898 1614 1664 2223 2135 2037 1620 1762 1941 2098 2504 2268 1794 2365 1888 2586
result:
ok 45 lines