QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#106732 | #6305. Chinese Checker | maspy | AC ✓ | 88ms | 3560kb | C++23 | 15.7kb | 2023-05-19 00:17:27 | 2023-05-19 00:17:29 |
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"
using BS = i128;
void solve() {
using T = array<int, 3>;
vvc<T> dat(17);
T A = {1, -1, 0};
T B = {0, 1, -1};
T C = {-1, 0, 1};
FOR(3) {
tie(A, B, C) = mt(B, C, A);
FOR(x, 5) FOR(y, 5) {
T p;
FOR(k, 3) p[k] = x * A[k] - y * C[k];
ll z = p[2] + 8;
dat[z].eb(p);
}
FOR(x, 5) FOR(y, 5) {
T p;
FOR(k, 3) p[k] = x * B[k] - y * C[k];
ll z = p[2] + 8;
dat[z].eb(p);
}
}
FOR(z, 17) UNIQUE(dat[z]);
map<T, int> IDX;
int p = 0;
FOR(i, len(dat)) {
for (auto&& t: dat[i]) { IDX[t] = p++; }
}
assert(p == 121);
vc<T> pos(p);
for (auto&& [a, b]: IDX) pos[b] = a;
BS init = 0;
LL(N);
FOR(N) {
INT(x, y);
--x, --y;
T t = dat[x][y];
int k = IDX[t];
init |= BS(1) << k;
}
ll ANS = 0;
FOR(k, 121) {
if (!(init >> k & 1)) continue;
using P = pair<int, BS>;
set<P> ss;
vc<P> que;
auto add = [&](int i, BS X) -> void {
P p = {i, X};
if (ss.count(p)) return;
ss.insert(p);
que.eb(p);
};
add(k, init);
while (len(que)) {
auto [idx, X] = POP(que);
FOR(j, 121) {
if (!(X >> j & 1)) continue;
T t;
t[0] = 2 * pos[j][0] - pos[idx][0];
t[1] = 2 * pos[j][1] - pos[idx][1];
t[2] = 2 * pos[j][2] - pos[idx][2];
auto dx = t[0] - pos[idx][0];
auto dy = t[1] - pos[idx][1];
auto dz = t[2] - pos[idx][2];
if (dx != 0 && dy != 0 && dz != 0) continue;
if (!IDX.count(t)) continue;
int i = IDX[t];
if (X >> i & 1) continue;
ll d = max({abs(dx), abs(dy), abs(dz)});
dx /= d, dy /= d, dz /= d;
int cnt = 0;
FOR(s, 1, d) {
int x = pos[idx][0] + dx * s;
int y = pos[idx][1] + dy * s;
int z = pos[idx][2] + dz * s;
T t = {x, y, z};
int it = IDX[t];
if (X >> it & 1) ++cnt;
}
if (cnt >= 2) continue;
BS Y = X;
Y ^= i128(1) << idx;
Y ^= i128(1) << i;
add(i, Y);
}
}
ANS += len(ss) - 1;
}
print(ANS);
}
signed main() {
INT(T);
FOR(T) solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3480kb
input:
5 1 1 1 2 1 1 2 1 2 9 4 9 6 10 1 1 2 1 2 2 3 1 3 2 3 3 4 1 4 2 4 3 4 4 10 1 1 2 1 2 2 5 7 3 2 3 3 4 1 4 2 4 3 4 4
output:
0 1 2 6 13
result:
ok 5 number(s): "0 1 2 6 13"
Test #2:
score: 0
Accepted
time: 50ms
memory: 3560kb
input:
100 81 1 1 16 1 11 4 13 8 12 3 12 12 11 1 4 2 9 5 8 10 5 5 9 7 3 2 14 1 7 11 13 7 10 2 8 3 9 8 10 6 12 10 6 7 11 2 7 3 13 12 8 6 17 1 10 5 5 12 13 9 13 1 9 4 5 10 11 8 13 4 5 4 9 1 7 8 5 6 13 13 5 1 9 3 8 8 8 5 13 2 13 5 11 3 9 2 6 4 3 3 8 2 13 11 8 7 5 7 6 10 11 9 10 3 11 10 6 3 7 1 4 4 15 2 7 2 3 ...
output:
190 376 211 492 381 228 151 39 328 87 1 141 103 65 25 137 394 294 10 214 91 188 263 16 102 236 304 443 172 84 218 281 25 7 104 181 429 282 51 163 276 47 10 164 79 181 30 145 333 122 200 291 0 105 115 54 22 5 62 159 167 26 447 163 209 4 52 0 251 109 100 405 0 348 75 105 75 353 66 28 474 362 6 190 90 ...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 50ms
memory: 3440kb
input:
100 38 6 11 13 8 7 2 7 4 11 3 12 1 7 6 6 3 4 2 5 1 12 8 10 3 12 4 10 7 15 3 14 4 3 1 5 12 6 12 10 10 13 7 8 6 15 2 15 1 7 5 5 5 8 3 12 3 4 1 7 3 1 1 5 9 8 10 11 6 11 1 11 11 16 2 9 5 46 11 9 10 4 8 6 12 10 11 1 6 8 6 3 7 10 6 6 12 3 9 7 10 1 14 4 12 9 6 1 5 3 7 8 8 4 6 5 5 2 14 2 9 1 6 7 3 3 7 3 11 ...
output:
369 402 268 186 336 29 31 295 421 434 38 1 3 228 271 56 139 316 20 49 176 265 515 176 258 294 258 134 445 7 7 47 311 149 283 276 102 169 247 17 226 512 24 231 101 324 0 0 56 156 160 23 99 0 58 266 170 51 2 443 15 3 58 322 21 31 276 3 164 311 57 21 120 250 198 318 30 151 342 59 277 75 347 198 322 73 ...
result:
ok 100 numbers
Test #4:
score: 0
Accepted
time: 46ms
memory: 3396kb
input:
100 67 11 11 7 9 10 1 13 7 16 2 11 7 5 6 12 9 12 11 10 9 11 9 13 4 5 5 4 1 6 5 7 2 13 3 13 11 5 8 2 2 6 7 14 3 7 10 12 4 13 12 12 1 4 3 16 1 10 4 8 9 5 10 5 1 13 10 4 4 6 1 13 2 11 8 5 7 8 10 11 10 13 13 6 2 6 10 7 8 8 4 6 8 9 3 6 12 8 2 14 4 12 10 3 1 7 4 4 2 8 7 7 6 7 1 5 12 5 11 3 3 5 9 6 11 11 1...
output:
319 301 374 170 318 2 1 249 112 389 173 59 201 409 148 163 0 256 383 466 46 440 447 264 281 67 306 293 201 252 583 226 15 67 0 33 83 5 4 95 41 74 202 25 112 29 279 203 332 243 59 45 225 39 0 83 321 234 409 172 256 194 1 94 1 106 50 9 204 18 342 37 12 262 72 167 4 53 125 348 12 0 4 101 3 65 290 97 14...
result:
ok 100 numbers
Test #5:
score: 0
Accepted
time: 45ms
memory: 3536kb
input:
100 23 6 9 3 1 1 1 7 3 8 10 13 9 7 10 11 4 8 4 13 7 5 4 9 7 7 11 8 6 11 2 11 6 10 5 12 10 15 1 13 5 5 1 7 5 6 10 82 6 2 3 3 11 5 10 2 12 1 7 2 5 3 8 6 7 9 2 2 10 7 10 10 10 8 6 8 8 3 12 10 11 9 9 7 5 1 8 10 13 4 6 6 1 1 5 2 13 13 7 8 7 10 17 1 11 1 12 12 6 1 13 6 14 2 15 1 13 8 12 9 12 6 6 3 16 2 9 ...
output:
189 217 8 326 256 407 168 315 97 260 94 141 53 0 117 294 149 200 278 182 300 407 71 186 306 46 175 81 82 59 156 162 539 0 143 306 0 5 2 0 0 127 32 453 159 238 135 11 0 21 38 12 51 128 162 187 19 428 372 127 0 149 0 33 0 11 188 172 186 2 26 99 46 128 310 14 252 186 182 269 279 282 166 246 194 70 29 2...
result:
ok 100 numbers
Test #6:
score: 0
Accepted
time: 45ms
memory: 3504kb
input:
100 52 5 11 5 4 9 5 8 5 5 2 8 7 17 1 13 9 7 3 11 9 6 6 9 7 12 9 8 3 10 3 6 4 8 8 10 7 9 1 7 2 15 2 7 9 11 10 3 3 7 1 4 2 13 2 12 2 4 3 5 7 5 3 6 3 8 6 11 3 3 2 7 5 7 10 11 2 3 1 11 8 11 7 13 13 7 8 16 2 16 1 10 1 7 7 13 3 9 3 6 2 12 1 6 7 77 5 9 9 3 14 4 12 7 13 1 6 6 7 8 8 5 5 13 9 2 11 10 12 12 1 ...
output:
268 194 131 20 174 379 10 204 296 58 43 304 4 26 298 96 41 279 106 238 274 20 121 10 235 145 1 250 0 36 24 57 147 86 172 221 222 354 57 349 5 50 317 360 8 8 271 233 5 403 263 291 428 4 73 30 306 85 239 42 196 267 24 2 221 20 335 365 93 423 333 5 134 17 0 6 245 213 112 252 51 274 288 57 126 24 322 17...
result:
ok 100 numbers
Test #7:
score: 0
Accepted
time: 73ms
memory: 3464kb
input:
100 50 11 5 8 6 12 7 14 4 8 4 6 6 7 10 13 2 10 9 13 12 12 1 10 2 6 8 14 1 15 3 3 1 5 6 13 10 5 10 10 10 5 3 7 4 11 4 9 3 11 9 11 1 9 7 12 10 17 1 7 6 4 4 12 8 13 7 8 2 8 7 9 6 8 1 8 8 12 2 3 3 5 1 15 1 12 5 10 3 7 9 9 9 1 1 14 2 10 8 5 5 50 12 7 11 4 8 2 9 4 16 2 9 3 4 2 5 6 4 4 6 2 11 10 3 2 7 7 5 ...
output:
403 352 337 347 289 335 286 344 311 297 352 504 343 271 229 288 280 262 375 380 410 308 285 241 349 313 503 458 370 316 282 377 249 340 332 269 320 369 352 367 316 384 349 288 398 294 274 230 225 247 253 256 326 437 290 306 238 265 302 333 524 330 338 478 262 234 278 353 456 351 292 500 392 284 261 ...
result:
ok 100 numbers
Test #8:
score: 0
Accepted
time: 88ms
memory: 3456kb
input:
100 55 6 3 11 6 11 5 8 6 15 3 7 3 13 4 11 11 12 7 5 4 7 5 9 6 11 1 13 6 9 1 12 2 13 1 3 3 8 8 5 6 11 3 14 3 8 10 1 1 10 3 10 6 14 4 6 7 13 3 7 7 5 13 10 4 11 8 17 1 12 6 11 7 14 1 10 10 6 10 8 2 8 5 16 2 5 3 13 5 13 11 8 1 7 6 6 1 3 1 7 10 7 2 5 9 6 6 10 2 10 1 55 7 4 10 8 13 1 8 3 12 4 4 2 11 9 6 1...
output:
297 273 256 378 387 300 311 350 397 302 333 403 262 508 317 363 276 438 452 251 606 288 200 221 449 278 404 457 315 276 410 307 327 296 291 358 341 367 371 309 269 413 338 340 490 372 360 295 386 316 440 267 280 333 342 230 338 366 311 231 210 496 412 417 300 235 428 207 239 405 285 476 391 282 382 ...
result:
ok 100 numbers
Test #9:
score: 0
Accepted
time: 84ms
memory: 3432kb
input:
100 60 6 7 2 2 7 5 10 3 8 1 12 10 9 6 10 6 13 1 9 2 12 2 13 10 15 1 8 10 15 2 10 1 5 1 5 2 5 10 12 1 7 11 3 3 12 4 7 2 9 5 7 6 11 6 5 12 13 2 13 5 10 5 7 9 3 1 16 1 10 4 4 2 9 3 12 11 1 1 11 7 9 4 10 2 5 5 13 8 5 7 6 3 3 2 13 13 12 12 16 2 8 3 7 10 8 5 13 6 14 2 10 9 6 6 9 8 6 5 10 7 60 13 13 3 1 10...
output:
263 221 365 327 230 235 317 302 306 373 220 274 273 333 333 395 418 350 309 215 230 327 265 373 435 433 286 274 218 301 326 252 456 300 365 354 355 463 252 354 366 394 274 246 306 287 289 374 275 391 380 380 265 280 306 380 395 339 345 333 321 196 307 382 255 248 305 302 363 285 291 290 238 267 264 ...
result:
ok 100 numbers
Test #10:
score: 0
Accepted
time: 29ms
memory: 3548kb
input:
100 121 12 1 5 1 3 2 13 6 8 10 10 5 6 9 4 2 13 8 16 1 7 10 7 1 11 5 10 8 10 2 12 7 15 3 13 5 1 1 5 12 17 1 5 2 13 11 9 6 8 4 6 2 11 4 11 10 14 2 4 3 12 3 6 12 4 1 7 6 13 13 10 10 5 11 5 13 6 1 13 4 10 7 8 7 13 12 7 9 9 9 6 8 9 3 5 6 7 2 14 1 12 5 11 2 8 6 11 7 9 2 6 10 12 10 5 9 5 5 2 1 13 1 3 1 11 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok 100 numbers