QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#631451 | #956. 后缀排序 | maspy | 100 ✓ | 93ms | 24264kb | C++20 | 21.0kb | 2024-10-12 04:09:32 | 2024-11-28 21:57:01 |
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/string/suffix_array.hpp"
#line 2 "/home/maspy/compro/library/alg/monoid/min.hpp"
template <typename E>
struct Monoid_Min {
using X = E;
using value_type = X;
static constexpr X op(const X &x, const X &y) noexcept { return min(x, y); }
static constexpr X unit() { return infty<E>; }
static constexpr bool commute = true;
};
#line 2 "/home/maspy/compro/library/ds/sparse_table/sparse_table.hpp"
// 冪等なモノイドであることを仮定。disjoint sparse table より x 倍高速
template <class Monoid>
struct Sparse_Table {
using MX = Monoid;
using X = typename MX::value_type;
int n, log;
vvc<X> dat;
Sparse_Table() {}
Sparse_Table(int n) { build(n); }
template <typename F>
Sparse_Table(int n, F f) {
build(n, f);
}
Sparse_Table(const vc<X>& v) { build(v); }
void build(int m) {
build(m, [](int i) -> X { return MX::unit(); });
}
void build(const vc<X>& v) {
build(len(v), [&](int i) -> X { return v[i]; });
}
template <typename F>
void build(int m, F f) {
n = m, log = 1;
while ((1 << log) < n) ++log;
dat.resize(log);
dat[0].resize(n);
FOR(i, n) dat[0][i] = f(i);
FOR(i, log - 1) {
dat[i + 1].resize(len(dat[i]) - (1 << i));
FOR(j, len(dat[i]) - (1 << i)) {
dat[i + 1][j] = MX::op(dat[i][j], dat[i][j + (1 << i)]);
}
}
}
X prod(int L, int R) {
if (L == R) return MX::unit();
if (R == L + 1) return dat[0][L];
int k = topbit(R - L - 1);
return MX::op(dat[k][L], dat[k][R - (1 << k)]);
}
template <class F>
int max_right(const F check, int L) {
assert(0 <= L && L <= n && check(MX::unit()));
if (L == n) return n;
int ok = L, ng = n + 1;
while (ok + 1 < ng) {
int k = (ok + ng) / 2;
bool bl = check(prod(L, k));
if (bl) ok = k;
if (!bl) ng = k;
}
return ok;
}
template <class F>
int min_left(const F check, int R) {
assert(0 <= R && R <= n && check(MX::unit()));
if (R == 0) return 0;
int ok = R, ng = -1;
while (ng + 1 < ok) {
int k = (ok + ng) / 2;
bool bl = check(prod(k, R));
if (bl) ok = k;
if (!bl) ng = k;
}
return ok;
}
};
#line 5 "/home/maspy/compro/library/string/suffix_array.hpp"
// 辞書順 i 番目の suffix が j 文字目始まりであるとき、
// SA[i] = j, ISA[j] = i
// |S|>0 を前提(そうでない場合 dummy 文字を追加して利用せよ)
struct Suffix_Array {
vc<int> SA;
vc<int> ISA;
vc<int> LCP;
Sparse_Table<Monoid_Min<int>> seg;
bool build_seg;
Suffix_Array(string& s) {
build_seg = 0;
assert(len(s) > 0);
char first = 127, last = 0;
for (auto&& c: s) {
chmin(first, c);
chmax(last, c);
}
SA = calc_suffix_array(s, first, last);
calc_LCP(s);
}
Suffix_Array(vc<int>& s) {
build_seg = 0;
assert(len(s) > 0);
SA = calc_suffix_array(s);
calc_LCP(s);
}
// lcp(S[i:], S[j:])
int lcp(int i, int j) {
if (!build_seg) {
build_seg = true;
seg.build(LCP);
}
int n = len(SA);
if (i == n || j == n) return 0;
if (i == j) return n - i;
i = ISA[i], j = ISA[j];
if (i > j) swap(i, j);
return seg.prod(i, j);
}
// S[i:] との lcp が n 以上であるような半開区間
pair<int, int> lcp_range(int i, int n) {
if (!build_seg) {
build_seg = true;
seg.build(LCP);
}
i = ISA[i];
int a = seg.min_left([&](auto e) -> bool { return e >= n; }, i);
int b = seg.max_right([&](auto e) -> bool { return e >= n; }, i);
return {a, b + 1};
}
// -1: S[L1:R1) < S[L2, R2)
// 0: S[L1:R1) = S[L2, R2)
// +1: S[L1:R1) > S[L2, R2)
int compare(int L1, int R1, int L2, int R2) {
int n1 = R1 - L1, n2 = R2 - L2;
int n = lcp(L1, L2);
if (n == n1 && n == n2) return 0;
if (n == n1) return -1;
if (n == n2) return 1;
return (ISA[L1 + n] > ISA[L2 + n] ? 1 : -1);
}
private:
void induced_sort(const vc<int>& vect, int val_range, vc<int>& SA,
const vc<bool>& sl, const vc<int>& lms_idx) {
vc<int> l(val_range, 0), r(val_range, 0);
for (int c: vect) {
if (c + 1 < val_range) ++l[c + 1];
++r[c];
}
partial_sum(l.begin(), l.end(), l.begin());
partial_sum(r.begin(), r.end(), r.begin());
fill(SA.begin(), SA.end(), -1);
for (int i = (int)lms_idx.size() - 1; i >= 0; --i)
SA[--r[vect[lms_idx[i]]]] = lms_idx[i];
for (int i: SA)
if (i >= 1 && sl[i - 1]) SA[l[vect[i - 1]]++] = i - 1;
fill(r.begin(), r.end(), 0);
for (int c: vect) ++r[c];
partial_sum(r.begin(), r.end(), r.begin());
for (int k = (int)SA.size() - 1, i = SA[k]; k >= 1; --k, i = SA[k])
if (i >= 1 && !sl[i - 1]) { SA[--r[vect[i - 1]]] = i - 1; }
}
vc<int> SA_IS(const vc<int>& vect, int val_range) {
const int n = vect.size();
vc<int> SA(n), lms_idx;
vc<bool> sl(n);
sl[n - 1] = false;
for (int i = n - 2; i >= 0; --i) {
sl[i] = (vect[i] > vect[i + 1] || (vect[i] == vect[i + 1] && sl[i + 1]));
if (sl[i] && !sl[i + 1]) lms_idx.push_back(i + 1);
}
reverse(lms_idx.begin(), lms_idx.end());
induced_sort(vect, val_range, SA, sl, lms_idx);
vc<int> new_lms_idx(lms_idx.size()), lms_vec(lms_idx.size());
for (int i = 0, k = 0; i < n; ++i)
if (!sl[SA[i]] && SA[i] >= 1 && sl[SA[i] - 1]) {
new_lms_idx[k++] = SA[i];
}
int cur = 0;
SA[n - 1] = cur;
for (size_t k = 1; k < new_lms_idx.size(); ++k) {
int i = new_lms_idx[k - 1], j = new_lms_idx[k];
if (vect[i] != vect[j]) {
SA[j] = ++cur;
continue;
}
bool flag = false;
for (int a = i + 1, b = j + 1;; ++a, ++b) {
if (vect[a] != vect[b]) {
flag = true;
break;
}
if ((!sl[a] && sl[a - 1]) || (!sl[b] && sl[b - 1])) {
flag = !((!sl[a] && sl[a - 1]) && (!sl[b] && sl[b - 1]));
break;
}
}
SA[j] = (flag ? ++cur : cur);
}
for (size_t i = 0; i < lms_idx.size(); ++i) lms_vec[i] = SA[lms_idx[i]];
if (cur + 1 < (int)lms_idx.size()) {
auto lms_SA = SA_IS(lms_vec, cur + 1);
for (size_t i = 0; i < lms_idx.size(); ++i) {
new_lms_idx[i] = lms_idx[lms_SA[i]];
}
}
induced_sort(vect, val_range, SA, sl, new_lms_idx);
return SA;
}
vc<int> calc_suffix_array(const string& s, const char first = 'a',
const char last = 'z') {
vc<int> vect(s.size() + 1);
copy(begin(s), end(s), begin(vect));
for (auto& x: vect) x -= (int)first - 1;
vect.back() = 0;
auto ret = SA_IS(vect, (int)last - (int)first + 2);
ret.erase(ret.begin());
return ret;
}
vc<int> calc_suffix_array(const vc<int>& s) {
vc<int> ss = s;
UNIQUE(ss);
vc<int> vect(s.size() + 1);
copy(all(s), vect.begin());
for (auto& x: vect) x = LB(ss, x) + 1;
vect.back() = 0;
auto ret = SA_IS(vect, MAX(vect) + 2);
ret.erase(ret.begin());
return ret;
}
template <typename STRING>
void calc_LCP(const STRING& s) {
int n = s.size(), k = 0;
ISA.resize(n);
LCP.resize(n);
for (int i = 0; i < n; i++) ISA[SA[i]] = i;
for (int i = 0; i < n; i++, k ? k-- : 0) {
if (ISA[i] == n - 1) {
k = 0;
continue;
}
int j = SA[ISA[i] + 1];
while (i + k < n && j + k < n && s[i + k] == s[j + k]) k++;
LCP[ISA[i]] = k;
}
LCP.resize(n - 1);
}
};
#line 5 "main.cpp"
void solve() {
STR(S);
Suffix_Array X(S);
auto SA = X.SA;
for (auto& x: SA) ++x;
print(SA);
}
signed main() { solve(); }
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 25
Accepted
Test #1:
score: 25
Accepted
time: 0ms
memory: 3788kb
input:
5Q2K2Pz3vL3K5NFJ48Lj77MYpTRo8dq25fS26BUl59i16a9kuxuFu4d477vz0057gB00218hv69C2Wz7Fk5pMt153uVAq3F3rK0T
output:
67 61 68 62 99 87 44 70 69 32 36 3 5 77 94 11 96 89 8 56 17 54 88 63 41 13 1 33 83 74 37 45 21 57 80 22 64 58 18 29 71 75 42 47 92 66 38 76 95 15 81 52 16 98 4 12 10 19 23 85 14 6 2 27 35 100 26 39 91 78 24 46 55 30 34 65 72 43 20 82 48 40 28 84 25 31 93 97 86 53 51 90 49 73 9 59 50 60 7 79
result:
ok 100 numbers
Test #2:
score: 25
Accepted
time: 0ms
memory: 3980kb
input:
5Q2K2Pz3vL3K5NFJ48Lj77MYpTRo8dq25fS26BUl59i16a9kuxuFu4d477vz0057gB00218hv69C2Wz7Fk5pMt153uVAq3F3rK0T6x537w3ME8JK5N1K1H2mQ25fhwSXF71PN7pq33144n03i7668I924792U1O299jyC066396197Az5XUG4436L1gj5ltv0K591DJu2Fb8UGV54Uz7B1E37583565h6XKWb011m429JT119a5Aa0nGP880GI7691f8bs920iq4725A9W7VYVLJrM7Y3KHhdO6562B34gqZ...
output:
67 834 61 984 435 230 932 390 302 791 991 68 961 835 551 887 814 423 143 749 541 62 166 729 910 465 764 663 382 361 252 193 481 996 99 366 668 700 265 321 985 246 843 804 737 807 854 851 436 813 239 231 543 927 848 680 139 767 744 317 87 560 724 44 775 783 800 718 70 172 657 445 240 401 499 756 794 ...
result:
ok 1000 numbers
Test #3:
score: 25
Accepted
time: 0ms
memory: 3780kb
input:
5Q2K2Pz3vL3K5NFJ48Lj77MYpTRo8dq25fS26BUl59i16a9kuxuFu4d477vz0057gB00218hv69C2Wz7Fk5pMt153uVAq3F3rK0T6x537w3ME8JK5N1K1H2mQ25fhwSXF71PN7pq33144n03i7668I924792U1O299jyC066396197Az5XUG4436L1gj5ltv0K591DJu2Fb8UGV54Uz7B1E37583565h6XKWb011m429JT119a5Aa0nGP880GI7691f8bs920iq4725A9W7VYVLJrM7Y3KHhdO6562B34gqZ...
output:
67 834 61 984 435 230 932 390 302 791 991 68 961 835 551 887 814 423 143 749 541 62 166 729 910 465 764 663 382 361 252 193 481 996 99 366 668 700 265 321 985 246 843 804 737 807 854 851 436 813 239 231 543 927 848 680 139 767 744 317 87 560 724 44 775 783 800 718 70 172 657 445 240 401 499 756 794 ...
result:
ok 1000 numbers
Subtask #2:
score: 25
Accepted
Dependency #1:
100%
Accepted
Test #4:
score: 25
Accepted
time: 1ms
memory: 3948kb
input:
5Q2K2Pz3vL3K5NFJ48Lj77MYpTRo8dq25fS26BUl59i16a9kuxuFu4d477vz0057gB00218hv69C2Wz7Fk5pMt153uVAq3F3rK0T6x537w3ME8JK5N1K1H2mQ25fhwSXF71PN7pq33144n03i7668I924792U1O299jyC066396197Az5XUG4436L1gj5ltv0K591DJu2Fb8UGV54Uz7B1E37583565h6XKWb011m429JT119a5Aa0nGP880GI7691f8bs920iq4725A9W7VYVLJrM7Y3KHhdO6562B34gqZ...
output:
1215 67 7665 834 1826 7511 5919 3053 61 3312 6300 2679 1594 4074 9549 3994 1216 9041 7309 984 435 9744 230 1246 7870 2136 1083 932 390 3023 6221 2107 5961 302 791 991 3530 3946 4059 9751 2781 68 5494 7719 5334 7001 8839 3525 2856 2330 4033 1358 7135 8275 7042 2156 1353 5431 1327 8878 1858 7963 6070 ...
result:
ok 10000 numbers
Test #5:
score: 25
Accepted
time: 1ms
memory: 4180kb
input:
5Q2K2Pz3vL3K5NFJ48Lj77MYpTRo8dq25fS26BUl59i16a9kuxuFu4d477vz0057gB00218hv69C2Wz7Fk5pMt153uVAq3F3rK0T6x537w3ME8JK5N1K1H2mQ25fhwSXF71PN7pq33144n03i7668I924792U1O299jyC066396197Az5XUG4436L1gj5ltv0K591DJu2Fb8UGV54Uz7B1E37583565h6XKWb011m429JT119a5Aa0nGP880GI7691f8bs920iq4725A9W7VYVLJrM7Y3KHhdO6562B34gqZ...
output:
1215 67 7665 834 1826 7511 5919 3053 61 3312 6300 2679 1594 4074 9549 3994 1216 9041 7309 984 435 9744 230 1246 7870 2136 1083 932 390 3023 6221 2107 5961 302 791 991 3530 3946 4059 9751 2781 68 5494 7719 5334 7001 8839 3525 2856 2330 4033 1358 7135 8275 7042 2156 1353 5431 1327 8878 1858 7963 6070 ...
result:
ok 10000 numbers
Subtask #3:
score: 25
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #6:
score: 25
Accepted
time: 0ms
memory: 5348kb
input:
5Q2K2Pz3vL3K5NFJ48Lj77MYpTRo8dq25fS26BUl59i16a9kuxuFu4d477vz0057gB00218hv69C2Wz7Fk5pMt153uVAq3F3rK0T6x537w3ME8JK5N1K1H2mQ25fhwSXF71PN7pq33144n03i7668I924792U1O299jyC066396197Az5XUG4436L1gj5ltv0K591DJu2Fb8UGV54Uz7B1E37583565h6XKWb011m429JT119a5Aa0nGP880GI7691f8bs920iq4725A9W7VYVLJrM7Y3KHhdO6562B34gqZ...
output:
68971 23766 16236 84001 1215 26527 48751 32248 30140 72030 28767 92557 43162 24259 25407 54376 75855 19511 13517 67 53747 87651 14066 82459 71782 86029 43950 97897 47837 7665 68972 13510 834 32328 99196 78406 83547 81136 78839 87297 70893 11242 63345 90340 71195 48534 1826 26208 37790 94754 94139 42...
result:
ok 100000 numbers
Test #7:
score: 25
Accepted
time: 3ms
memory: 5612kb
input:
5Q2K2Pz3vL3K5NFJ48Lj77MYpTRo8dq25fS26BUl59i16a9kuxuFu4d477vz0057gB00218hv69C2Wz7Fk5pMt153uVAq3F3rK0T6x537w3ME8JK5N1K1H2mQ25fhwSXF71PN7pq33144n03i7668I924792U1O299jyC066396197Az5XUG4436L1gj5ltv0K591DJu2Fb8UGV54Uz7B1E37583565h6XKWb011m429JT119a5Aa0nGP880GI7691f8bs920iq4725A9W7VYVLJrM7Y3KHhdO6562B34gqZ...
output:
68971 23766 16236 84001 1215 26527 48751 32248 30140 72030 28767 92557 43162 24259 25407 54376 75855 19511 13517 67 53747 87651 14066 82459 71782 86029 43950 97897 47837 7665 68972 13510 834 32328 99196 78406 83547 81136 78839 87297 70893 11242 63345 90340 71195 48534 1826 26208 37790 94754 94139 42...
result:
ok 100000 numbers
Subtask #4:
score: 25
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #8:
score: 25
Accepted
time: 82ms
memory: 24220kb
input:
5Q2K2Pz3vL3K5NFJ48Lj77MYpTRo8dq25fS26BUl59i16a9kuxuFu4d477vz0057gB00218hv69C2Wz7Fk5pMt153uVAq3F3rK0T6x537w3ME8JK5N1K1H2mQ25fhwSXF71PN7pq33144n03i7668I924792U1O299jyC066396197Az5XUG4436L1gj5ltv0K591DJu2Fb8UGV54Uz7B1E37583565h6XKWb011m429JT119a5Aa0nGP880GI7691f8bs920iq4725A9W7VYVLJrM7Y3KHhdO6562B34gqZ...
output:
702437 852879 412799 162791 928297 702438 622989 983054 642549 261095 377477 552453 679737 416887 68971 278337 315744 160869 995837 186829 681266 327995 277671 818964 351970 838627 883654 348201 749182 652099 725131 290366 677064 877296 529774 170877 594821 447484 471517 964025 208565 255655 507795 ...
result:
ok 1000000 numbers
Test #9:
score: 25
Accepted
time: 93ms
memory: 24264kb
input:
eX8N69cLH4G7P8QDy5156Hx8m0VN4sH9t0C4MoGd0cN51dgGXJL73z6N20CLISd0X1nhFKvdXa5q2nWCMjmkM30Es5tAZ5L6c306nT2oQfrf2Zt510ofV35o9TJ5T811LtWMrZyh18MX9qw72109C5be766Bd3qLO4xD1DDe479eUE5987M7D8Y895fT1W8v76E093n631511T0UVJh29806570CW9b5Is483605N8654a5VWS08UxTJE91bpt43f74q0hkMd1Z9a23he6MAE3kG0u5127tc3h5f8y39AjD9...
output:
38596 639028 437546 648133 351969 176869 229309 186806 709078 462998 756773 229120 449395 203997 694956 387238 859598 730372 206962 594419 304109 865880 486633 87868 144959 580819 713317 427972 274476 938366 686801 782959 62962 785003 847579 57996 600405 148706 255431 125253 470979 965679 925624 274...
result:
ok 1000000 numbers
Test #10:
score: 25
Accepted
time: 82ms
memory: 24112kb
input:
8585jh1f9l3466C87O58gfT7sPR0Vw2kdl75l450z1aiD294Q98lb2h4eWb77E8O987OzoJ1617c76ewlDF6G35z0p51g7X53r9642d72kX96JaJra72G832G87vyY42UVx980GB137H85hg47CMn3o1249D6aaGPCr8z3f0pptL20TH1X6ec0vg1zJ22kw3DF96bCo708qr75G8n59J3v7m2164IX1N84D8O10byi86jR44lQ7U9ccl490428AkdTY6830E7VVf5705W86IJ0MvY94653hx18on20J44890...
output:
73767 216802 73768 690419 604466 827813 587942 736629 238255 331491 654128 797636 599436 533392 476737 533131 558055 861637 813759 428079 371878 574078 216803 151038 556486 238788 165007 289648 324429 383245 331977 951071 341486 342866 674032 50992 680691 104594 382352 956720 401592 251525 523118 51...
result:
ok 1000000 numbers
Test #11:
score: 25
Accepted
time: 11ms
memory: 13868kb
input:
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk...
output:
494293 494292 494291 494290 494289 494288 494287 494286 494285 494284 494283 494282 494281 494280 494279 494278 494277 494276 494275 494274 494273 494272 494271 494270 494269 494268 494267 494266 494265 494264 494263 494262 494261 494260 494259 494258 494257 494256 494255 494254 494253 494252 494251...
result:
ok 494293 numbers
Test #12:
score: 25
Accepted
time: 26ms
memory: 8860kb
input:
ukamzkyruvymqmfqoewpyzdrtrkzmwdvxcckmwsmuhkaobmvdalkzetetqhfvhjcgpvirkoeuhvnyixcjsifrzemlbvlaeqikyytrqlhlynrfewgaqziacutmpavtpuocdznxdspzsdklbkagxkbmmvxpdrsnjcjgdpgjxgavyolbgmedsomwsmdxnmgojpedauuickphpjmppmlgsyercqmdkohoajkuwbkkvdowkhlpjpsimufipsepdwdmcijcrvupexnnpzsgrrnfgzbbkjmjdcdttwospaxpdgqmdsk...
output:
12772 117907 162347 228041 225586 233722 223495 259119 156380 82369 83353 181439 33259 153134 12773 143652 213887 156453 200482 30753 29703 49060 117908 69290 231062 79531 112022 15989 11215 90837 7733 183799 240773 41419 160190 28958 129822 128264 102169 247780 123357 222081 166805 140556 110611 11...
result:
ok 262144 numbers
Test #13:
score: 25
Accepted
time: 0ms
memory: 3668kb
input:
mississippi
output:
11 8 5 2 1 10 9 7 4 6 3
result:
ok 11 numbers
Test #14:
score: 25
Accepted
time: 36ms
memory: 17476kb
input:
badabacabaeabacabadabacabafabacabadabacabaeabacabadabacabaiabacabadabacabaeabacabadabacabafabacabadabacabaeabacabadabacabagabacabadabacabaeabacabadabacabafabacabadabacabaeabacabadabacabahabacabadabacabaeabacabadabacabafabacabadabacabaeabacabadabacabagabacabadabacabaeabacabadabacabafabacabadabacabaea...
output:
493306 493304 493300 493292 493276 493244 493116 492860 492348 491324 487228 454460 323388 61244 192316 388924 126780 257852 356156 94012 225084 421692 159548 290620 28476 470844 339772 77628 208700 405308 143164 274236 12092 372540 110396 241468 438076 175932 307004 44860 462652 331580 69436 200508...
result:
ok 493306 numbers
Test #15:
score: 25
Accepted
time: 21ms
memory: 13692kb
input:
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...
output:
490812 490811 490810 490809 490808 490807 490806 490805 490804 490803 490802 490801 490800 490799 490798 490797 490796 490795 490794 490793 490792 490791 490790 490789 490788 490787 490786 490785 490784 490783 490782 490781 490780 490779 490778 490777 490776 490775 490774 490773 490772 490771 490770...
result:
ok 490812 numbers
Test #16:
score: 25
Accepted
time: 31ms
memory: 17436kb
input:
abadabacabagabacabadabacabaeabacabadabacabafabacabadabacabaeabacabadabacabaiabacabadabacabaeabacabadabacabafabacabadabacabaeabacabadabacabagabacabadabacabaeabacabadabacabafabacabadabacabaeabacabadabacabahabacabadabacabaeabacabadabacabafabacabadabacabaeabacabadabacabagabacabadabacabaeabacabadabacabaf...
output:
491321 491317 491309 491277 491213 491085 490829 486733 478541 462157 396621 134477 265549 3405 200013 331085 68941 429389 167245 298317 36173 232781 363853 101709 413005 150861 281933 19789 216397 347469 85325 445773 183629 314701 52557 249165 380237 118093 470349 404813 142669 273741 11597 208205 ...
result:
ok 491322 numbers
Test #17:
score: 25
Accepted
time: 18ms
memory: 13712kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
491322 491321 491320 491319 491318 491317 491316 491315 491314 491313 491312 491311 491310 491309 491308 491307 491306 491305 491304 491303 491302 491301 491300 491299 491298 491297 491296 491295 491294 491293 491292 491291 491290 491289 491288 491287 491286 491285 491284 491283 491282 491281 491280...
result:
ok 491322 numbers
Test #18:
score: 25
Accepted
time: 26ms
memory: 9092kb
input:
fkuhtcgbqrgrvxfhpaprzbckhqfpzmrteohjuxabvtbjzpxqslilbdlkalsycwrlpfotfoqrwfzelgmhtczzjlclfccwuudfwvpkskjlxogmxzezzrwadlsotwbkkscnjryacfrxwpeanzzhmuysmvszwgjlygpcgbgjrdsnyduhjndfzkdwlpyhwpocbkkrcymjngxxsdtcowvscpthitnmncuoykwxdaaxiobtvkkxyzbqkmsaflyrnqppitvmjnpjgomyrffainynjiixsdwzvcossmjbsnzhgsfmvdcj...
output:
88693 163089 26471 229424 91162 208635 12849 241141 214306 183295 223145 73572 88694 91323 244198 227546 163090 43593 88856 202607 153583 116965 109299 68277 140432 248380 56933 24945 106218 149016 124155 9305 94411 214783 141261 213992 26598 50831 135224 83675 240398 34685 29741 237247 123549 36028...
result:
ok 262143 numbers
Test #19:
score: 25
Accepted
time: 0ms
memory: 3680kb
input:
abcbcba
output:
7 1 6 4 2 5 3
result:
ok 7 numbers
Test #20:
score: 25
Accepted
time: 0ms
memory: 3692kb
input:
wzvptctlnujsoddwexnqkgwckhiukybwwbykuihkcwgkqnxewddosjunltctpvzw
output:
31 34 24 6 59 41 50 14 51 15 48 17 43 22 26 39 38 27 11 54 40 21 25 44 36 29 8 57 56 19 9 46 13 52 4 61 20 45 53 12 5 58 7 60 37 10 28 55 3 62 64 33 23 49 16 42 32 1 47 18 30 35 2 63
result:
ok 64 numbers
Test #21:
score: 25
Accepted
time: 22ms
memory: 13816kb
input:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
output:
323793 7826 455174 500000 323792 7825 455173 499999 323791 7824 455172 499998 323790 7823 455171 499997 323789 7822 455170 499996 323788 7821 455169 499995 323787 7820 455168 499994 323786 7819 455167 499993 323785 7818 455166 499992 323784 7817 455165 499991 323783 7816 455164 499990 323782 7815 45...
result:
ok 500000 numbers
Test #22:
score: 25
Accepted
time: 0ms
memory: 3560kb
input:
tmsxctmsbthushjkboernkfxnszgzkrkvdvcevefmibqclupzn
output:
17 43 9 36 45 5 34 39 19 37 40 23 28 14 11 42 15 16 22 30 32 46 41 7 2 50 21 25 18 48 44 31 20 8 13 3 26 10 6 1 47 12 35 33 38 4 24 27 29 49
result:
ok 50 numbers
Test #23:
score: 25
Accepted
time: 43ms
memory: 13052kb
input:
kuhtcgbqrgrvxfhpaprzbckhqfpzmrteohjuxabvtbjzpxqslilbdlkalsycwrlpfotfoqrwfzelgmhtczzjlclfccwuudfwvpkskjlxogmxzezzrwadlsotwbkkscnjryacfrxwpeanzzhmuysmvszwgjlygpcgbgjrdsnyduhjndfzkdwlpyhwpocbkkrcymjngxxsdtcowvscpthitnmncuoykwxdaaxiobtvkkxyzbqkmsaflyrnqppitvmjnpjgomyrffainynjiixsdwzvcossmjbsnzhgsfmvdcjj...
output:
88692 163088 360873 26470 229423 91161 208634 447897 379107 12848 333503 241140 447172 214305 266092 358086 352038 183294 348179 451045 223144 73571 369965 88693 91322 244197 281308 227545 163089 43592 88855 368425 202606 153582 116964 109298 68276 140431 248379 56932 24944 106217 149015 124154 9304...
result:
ok 463046 numbers
Test #24:
score: 25
Accepted
time: 20ms
memory: 12352kb
input:
gbquhtgbquhtgbqgbquhtgbquhtgbqgbquhtgbqgbquhtgbquhtgbqgbquhtgbquhtgbqgbquhtgbqgbquhtgbquhtgbqgbquhtgbqgbquhtgbquhtgbqgbquhtgbquhtgbqgbquhtgbqgbquhtgbquhtgbqgbquhtgbquhtgbqgbquhtgbqgbquhtgbquhtgbqgbquhtgbqgbquhtgbquhtgbqgbquhtgbquhtgbqgbquhtgbqgbquhtgbquhtgbqgbquhtgbqgbquhtgbquhtgbqgbquhtgbquhtgbqgbq...
output:
364178 364169 364145 364082 363917 363485 362354 359393 351641 331346 278213 139109 192242 53138 298508 245375 106271 159404 20300 212537 73433 339098 318803 265670 126566 179699 40595 285965 232832 93728 146861 7757 199994 60890 306260 253127 114023 167156 28052 220289 81185 354602 346850 326555 27...
result:
ok 364179 numbers
Test #25:
score: 25
Accepted
time: 39ms
memory: 13844kb
input:
orkkdwgzumjpimrgnmdvpjqesgjnxcxovhujkbjkyxidftajlpfarlkqfwoitvhthifoquzmryqavmqxnaenlqtpssurirqwhvgmdncrddzxxifvznunraxjreniogusydegbrvfzcnbfgrzpejwlfvtyzpglaiqxouszdcajiqwmcpsytenedsebqqjgttdqrbtyjbowhfadozolxahyzoitthoudnisiopkzppjickusgvfjhnzdbekglslnfgpvattzgzhhbdtyqvuyahqjxhctcrmbvjhhrskwenbdhk...
output:
490325 319626 305457 335165 4120 390093 192725 72022 38036 123030 404490 73903 492664 483615 331725 32763 414336 196651 444462 261822 226135 490326 86349 419924 88620 203034 205295 87304 275218 359182 222836 129555 284486 78259 476844 83451 301129 127083 142392 212396 477489 233179 307372 173114 124...
result:
ok 493264 numbers
Test #26:
score: 25
Accepted
time: 0ms
memory: 3740kb
input:
ukamzkyruvymqmfqoewpyzdrt
output:
3 23 18 15 2 6 14 12 4 17 20 13 16 24 8 25 1 9 10 19 11 7 21 22 5
result:
ok 25 numbers
Test #27:
score: 25
Accepted
time: 9ms
memory: 8716kb
input:
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
output:
262143 262142 262141 262140 262139 262138 262137 262136 262135 262134 262133 262132 262131 262130 262129 262128 262127 262126 262125 262124 262123 262122 262121 262120 262119 262118 262117 262116 262115 262114 262113 262112 262111 262110 262109 262108 262107 262106 262105 262104 262103 262102 262101...
result:
ok 262143 numbers
Test #28:
score: 25
Accepted
time: 43ms
memory: 13900kb
input:
kfuqarsxhnzfukomwlgrdjrykphticxyantjdcmycglnquwsxxwekmkjlbkclnxkoninbpqaguppzzwaolrlxdtcxzwtbvjlygpgasavqichyffxriunznnxmuglcrgwthcepjbdwuydzxmbcawgjqqghzjgqpqefoqbebgfckovvuryydkongmlztyvpcqlyeaevxcwglodhvygffcnlylemcztyhsvhwchmpyulowsdqpregvcdeuxjbmwxxugrovjiowjqleyqrczxoezqyryervbfksiyhndjbowrgde...
output:
73816 73817 173139 313969 348238 160792 267011 327545 276798 425360 394062 226716 423237 393793 162380 114558 446981 205431 417344 410888 68277 11001 193640 185645 451095 294107 421691 183082 333382 301352 119194 118772 351896 317783 346257 222559 33717 265096 51366 353526 11778 73818 412875 121640 ...
result:
ok 494183 numbers
Test #29:
score: 25
Accepted
time: 23ms
memory: 9044kb
input:
msxctmsbthushjkboernkfxnszgzkrkvdvcevefmibqclupznvuuimtnejmkjihhyxcikebojhiuusrprnfyjvzuzhwegpkfsqzqluaitsxumkcoljyrwafyvcgctyxufkkwoketfbmfdjdtlestmoggkikxgjbaotmrthnahlvubfvmbhniykppapfpudglulvxffpgiimtoetzuvvmgtxsawrstglsyajjagjtepcrqftzcwwnqufpghwmgeagetbedwnjbfrdvhbsgocodgkyfilpbztpuhoefhjyqyas...
output:
179117 276956 276821 266803 115100 201199 16046 58290 168694 76053 179118 127782 102784 54878 234281 114616 251010 157392 154047 253183 276957 213987 153046 44097 6286 129311 104823 65394 258438 75563 61817 82480 161790 276822 29604 156002 201550 8963 208234 48315 95314 96556 51524 34608 253303 7130...
result:
ok 277012 numbers
Test #30:
score: 25
Accepted
time: 0ms
memory: 3560kb
input:
fkuhtcgbqrgrvxfhpaprzbckhq
output:
18 22 8 6 23 15 1 7 11 16 25 4 24 2 17 19 26 9 10 12 20 5 3 13 14 21
result:
ok 26 numbers
Test #31:
score: 25
Accepted
time: 23ms
memory: 15480kb
input:
msbtmsxcmsbtmsxcmsbtmsbtmsxcmsbtmsxcmsbtmsbtmsxcmsbtmsbtmsxcmsbtmsxcmsbtmsbtmsxcmsbtmsxcmsbtmsbtmsxcmsbtmsbtmsxcmsbtmsxcmsbtmsbtmsxcmsbtmsbtmsxcmsbtmsxcmsbtmsbtmsxcmsbtmsxcmsbtmsbtmsxcmsbtmsbtmsxcmsbtmsxcmsbtmsbtmsxcmsbtmsxcmsbtmsbtmsxcmsbtmsbtmsxcmsbtmsxcmsbtmsbtmsxcmsbtmsbtmsxcmsbtmsxcmsbtmsbtmsxc...
output:
485571 485559 485527 485443 485223 484647 483139 479191 468855 441795 370951 185479 256323 70851 398011 327167 141695 212539 27067 283383 97911 452131 425071 354227 168755 239599 54127 381287 310443 124971 195815 10343 266659 81187 408347 337503 152031 222875 37403 293719 108247 472803 462467 435407...
result:
ok 485572 numbers
Test #32:
score: 25
Accepted
time: 3ms
memory: 8852kb
input:
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu...
output:
262144 262143 262142 262141 262140 262139 262138 262137 262136 262135 262134 262133 262132 262131 262130 262129 262128 262127 262126 262125 262124 262123 262122 262121 262120 262119 262118 262117 262116 262115 262114 262113 262112 262111 262110 262109 262108 262107 262106 262105 262104 262103 262102...
result:
ok 262144 numbers
Test #33:
score: 25
Accepted
time: 0ms
memory: 3976kb
input:
bzbxnxfrtckgfvlnsaayclgjrwfvabudblcsjnjrlfubvlvhrbezzgn
output:
18 29 19 50 33 30 44 3 1 10 21 35 32 51 7 42 27 13 12 23 54 48 37 39 24 11 34 41 22 15 46 55 38 16 5 49 40 8 25 17 36 9 43 31 28 47 14 45 26 6 4 20 2 53 52
result:
ok 55 numbers
Test #34:
score: 25
Accepted
time: 27ms
memory: 13688kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
500000 499999 499998 499997 499996 499995 499994 499993 499992 499991 499990 499989 499988 499987 499986 499985 499984 499983 499982 499981 499980 499979 499978 499977 499976 499975 499974 499973 499972 499971 499970 499969 499968 499967 499966 499965 499964 499963 499962 499961 499960 499959 499958...
result:
ok 500000 numbers
Test #35:
score: 25
Accepted
time: 0ms
memory: 3968kb
input:
jofjhizstdgaqfuaphofdtrcyosejhkkcnxyreelgllgrlvhtfs
output:
16 12 33 24 10 21 38 28 39 20 3 50 14 11 41 44 5 30 18 48 6 4 29 1 32 31 40 43 42 46 34 19 2 26 17 13 23 37 45 51 27 8 9 49 22 15 47 35 25 36 7
result:
ok 51 numbers
Test #36:
score: 25
Accepted
time: 23ms
memory: 11620kb
input:
kamzkyruvymqmfqoewpyzdrtrkzmwdvxcckmwsmuhkaobmvdalkzetetqhfvhjcgpvirkoeuhvnyixcjsifrzemlbvlaeqikyytrqlhlynrfewgaqziacutmpavtpuocdznxdspzsdklbkagxkbmmvxpdrsnjcjgdpgjxgavyolbgmedsomwsmdxnmgojpedauuickphpjmppmlgsyercqmdkohoajkuwbkkvdowkhlpjpsimufipsepdwdmcijcrvupexnnpzsgrrnfgzbbkjmjdcdttwospaxpdgqmdskj...
output:
12771 117906 162346 228040 225585 233721 223494 259118 156379 328405 82368 83352 181438 33258 153133 347817 12772 313249 143651 303673 262846 304672 213886 156452 200481 30752 29702 298799 49059 358511 117907 69289 231061 79530 112021 15988 265040 11214 90836 7732 183798 240772 352192 372238 41418 3...
result:
ok 389813 numbers
Test #37:
score: 25
Accepted
time: 25ms
memory: 16268kb
input:
kamzkrrkamzkrrkamzkrkamzkrrkamzkrrkamzkrkamzkrrkamzkrkamzkrrkamzkrrkamzkrkamzkrrkamzkrrkamzkrkamzkrrkamzkrkamzkrrkamzkrrkamzkrkamzkrrkamzkrkamzkrrkamzkrrkamzkrkamzkrrkamzkrrkamzkrkamzkrrkamzkrkamzkrrkamzkrrkamzkrkamzkrrkamzkrrkamzkrkamzkrrkamzkrkamzkrrkamzkrrkamzkrkamzkrrkamzkrkamzkrrkamzkrrkamzkrka...
output:
496514 496501 496468 496382 496157 495568 494026 489989 479420 451750 379309 189656 262097 72444 406979 334538 144885 217326 27673 289767 100114 462319 434649 362208 172555 244996 55343 389878 317437 127784 200225 10572 272666 83013 417548 345107 155454 227895 38242 300336 110683 483457 472888 44521...
result:
ok 496518 numbers
Test #38:
score: 25
Accepted
time: 19ms
memory: 13840kb
input:
tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt...
output:
82483 234936 116692 287359 500000 82482 234935 116691 287358 499999 82481 234934 116690 287357 499998 82480 234933 116689 287356 499997 82479 234932 116688 287355 499996 82478 234931 116687 287354 499995 82477 234930 116686 287353 499994 82476 234929 116685 287352 499993 82475 234928 116684 287351 4...
result:
ok 500000 numbers
Test #39:
score: 25
Accepted
time: 43ms
memory: 13744kb
input:
kuhtcgbqrgrvxfhpaprzbckhqfpzmrteohjuxabvtbjzpxqslilbdlkalsycwrlpfotfoqrwfzelgmhtczzjlclfccwuudfwvpkskjlxogmxzezzrwadlsotwbkkscnjryacfrxwpeanzzhmuysmvszwgjlygpcgbgjrdsnyduhjndfzkdwlpyhwpocbkkrcymjngxxsdtcowvscpthitnmncuoykwxdaaxiobtvkkxyzbqkmsaflyrnqppitvmjnpjgomyrffainynjiixsdwzvcossmjbsnzhgsfmvdcjj...
output:
88692 163088 360873 26470 229423 91161 208634 447897 379107 12848 333503 241140 447172 214305 266092 358086 352038 183294 348179 451045 471440 223144 73571 369965 88693 91322 244197 281308 227545 163089 43592 88855 368425 202606 153582 116964 109298 68276 140431 248379 56932 24944 106217 149015 1241...
result:
ok 494293 numbers
Test #40:
score: 25
Accepted
time: 0ms
memory: 3648kb
input:
xkfuqarsxhnzfukomwlgrdjrykp
output:
6 22 13 3 20 10 23 2 15 26 19 17 11 16 27 5 21 7 24 8 14 4 18 9 1 25 12
result:
ok 27 numbers
Test #41:
score: 25
Accepted
time: 15ms
memory: 13772kb
input:
tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt...
output:
499919 499492 499858 249981 498027 496074 499950 468731 499981 499004 484356 7123 374981 499918 499491 499857 249980 498026 496073 499949 468730 499980 499003 484355 7122 374980 499917 499490 499856 249979 498025 496072 499948 468729 499979 499002 484354 7121 374979 499916 499489 499855 249978 49802...
result:
ok 499981 numbers
Test #42:
score: 25
Accepted
time: 0ms
memory: 3752kb
input:
ysmuruvrbuqvrmxmbqbylfcakbmhigggbzhysbecbrcuvrykwfjal
output:
24 52 38 26 17 41 9 19 33 23 40 43 39 22 50 32 31 30 28 35 29 51 25 48 53 21 16 27 3 14 18 11 8 42 13 5 46 37 2 10 4 6 44 7 12 45 49 15 47 20 36 1 34
result:
ok 53 numbers
Test #43:
score: 25
Accepted
time: 35ms
memory: 12512kb
input:
orkkdwgzumjpimrgnmdvpjqesgjnxcxovhujkbjkyxidftajlpfarlkqfwoitvhthifoquzmryqavmqxnaenlqtpssurirqwhvgmdncrddzxxifvznunraxjreniogusydegbrvfzcnbfgrzpejwlfvtyzpglaiqxouszdcajiqwmcpsytenedsebqqjgttdqrbtyjbowhfadozolxahyzoitthoudnisiopkzppjickusgvfjhnzdbekglslnfgpvattzgzhhbdtyqvuyahqjxhctcrmbvjhhrskwenbdhk...
output:
319626 305457 335165 4120 390093 192725 72022 38036 123030 404490 73903 331725 32763 414336 196651 261822 226135 86349 419924 88620 203034 205295 87304 275218 359182 222836 129555 284486 78259 83451 301129 127083 142392 212396 233179 307372 173114 124678 320591 274994 182139 231308 92690 224935 3196...
result:
ok 429249 numbers
Test #44:
score: 25
Accepted
time: 0ms
memory: 3744kb
input:
fitrjctqatgxsuhqrsjmmxrnvmmowjohiqftmawbylsqqjcdhutl
output:
9 38 40 47 6 48 1 35 11 32 15 49 33 2 46 5 19 30 52 42 37 26 20 27 21 24 31 28 8 34 45 44 16 4 23 17 18 43 13 10 51 36 7 3 14 50 25 39 29 22 12 41
result:
ok 52 numbers
Test #45:
score: 25
Accepted
time: 0ms
memory: 3640kb
input:
a
output:
1
result:
ok 1 number(s): "1"
Test #46:
score: 25
Accepted
time: 18ms
memory: 10896kb
input:
okkkkokkkkokkokkkkokkkkokkokkkkokkokkkkokkkkokkokkkkokkkkokkokkkkokkokkkkokkkkokkokkkkokkokkkkokkkkokkokkkkokkkkokkokkkkokkokkkkokkkkokkokkkkokkkkokkokkkkokkokkkkokkkkokkokkkkokkokkkkokkkkokkokkkkokkkkokkokkkkokkokkkkokkkkokkokkkkokkokkkkokkkkokkokkkkokkkkokkokkkkokkokkkkokkkkokkokkkkokkkkokkokkkkok...
output:
317811 317810 317805 317792 317758 317669 317436 316826 315229 311048 300102 271445 196420 2 75027 225077 150052 28659 103684 282391 253734 178709 57316 207366 132341 10948 85973 236023 160998 39605 114630 304283 293337 264680 189655 68262 218312 143287 21894 96919 275626 246969 171944 50551 200601 ...
result:
ok 317811 numbers
Test #47:
score: 25
Accepted
time: 41ms
memory: 13676kb
input:
sxctmsbthushjkboernkfxnszgzkrkvdvcevefmibqclupznvuuimtnejmkjihhyxcikebojhiuusrprnfyjvzuzhwegpkfsqzqluaitsxumkcoljyrwafyvcgctyxufkkwoketfbmfdjdtlestmoggkikxgjbaotmrthnahlvubfvmbhniykppapfpudglulvxffpgiimtoetzuvvmgtxsawrstglsyajjagjtepcrqftzcwwnqufpghwmgeagetbedwnjbfrdvhbsgocodgkyfilpbztpuhoefhjyqyasz...
output:
179116 276955 333634 276820 294976 266802 286121 393905 483266 459404 354179 421456 447318 115099 433501 201198 351291 16045 58289 283813 399930 437177 424634 168693 76052 350101 179117 127781 363093 444955 316479 467927 298724 102783 54877 234280 426131 114615 251009 157391 154046 289853 323445 253...
result:
ok 490812 numbers
Test #48:
score: 25
Accepted
time: 26ms
memory: 13552kb
input:
tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt...
output:
499981 124001 499980 124000 499979 123999 499978 123998 499977 123997 499976 123996 499975 123995 499974 123994 499973 123993 499972 123992 499971 123991 499970 123990 499969 123989 499968 123988 499967 123987 499966 123986 499965 123985 499964 123984 499963 123983 499962 123982 499961 123981 499960...
result:
ok 499981 numbers
Test #49:
score: 25
Accepted
time: 3ms
memory: 4524kb
input:
kfuqarsxhnzfukomwlgrdjrykphticxyantjdcmycglnquwsxxwekmkjlbkclnxkoninbpqaguppzzwaolrlxdtcxzwtbvjlygpgasavqichyffxriunznnxmuglcrgwthcepjbdwuydzxmbcawgjqqghzjgqpqefoqbebgfckovvuryydkongmlztyvpcqlyeaevxcwglodhvygffcnlylemcztyhsvhwchmpyulowsdqpregvcdeuxjbmwxxugrovjiowjqleyqrczxoezqyryervbfksiyhndjbowrgde...
output:
11001 33717 51366 11778 35050 30778 36134 20376 22867 53080 1585 6106 13448 30160 11550 21933 4250 50089 45787 44627 15128 12297 34425 4539 48739 2186 7708 32228 15261 7594 21815 34871 51631 53103 37663 29702 19513 8484 38503 21862 30923 20477 18223 8437 1360 46739 44174 11002 13296 7616 24906 22656...
result:
ok 53336 numbers
Test #50:
score: 25
Accepted
time: 0ms
memory: 3972kb
input:
swayjuadxyrxlnzmkkadhleqplweklntdsvnckkrgbqgbuoclqlav
output:
19 7 52 3 42 45 37 48 20 33 8 28 23 41 44 21 5 18 17 38 29 39 51 22 30 13 49 26 16 36 31 14 47 25 43 50 24 40 11 34 1 32 6 46 53 35 2 27 12 9 4 10 15
result:
ok 53 numbers
Test #51:
score: 25
Accepted
time: 8ms
memory: 11308kb
input:
fuqrrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrrfuqrfuqrrfuqrfuqrrfuqr...
output:
346465 346456 346433 346373 346216 345805 344729 341912 334537 315229 264680 132341 182890 50551 283988 233439 101100 151649 19310 202198 69859 322604 303296 252747 120408 170957 38618 272055 221506 89167 139716 7377 190265 57926 291363 240814 108475 159024 26685 209573 77234 337354 329979 310671 26...
result:
ok 346468 numbers
Test #52:
score: 25
Accepted
time: 19ms
memory: 13608kb
input:
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj...
output:
244655 415428 57930 305728 500000 244654 415427 57929 305727 499999 244653 415426 57928 305726 499998 244652 415425 57927 305725 499997 244651 415424 57926 305724 499996 244650 415423 57925 305723 499995 244649 415422 57924 305722 499994 244648 415421 57923 305721 499993 244647 415420 57922 305720 4...
result:
ok 500000 numbers
Test #53:
score: 25
Accepted
time: 38ms
memory: 13840kb
input:
amzkyruvymqmfqoewpyzdrtrkzmwdvxcckmwsmuhkaobmvdalkzetetqhfvhjcgpvirkoeuhvnyixcjsifrzemlbvlaeqikyytrqlhlynrfewgaqziacutmpavtpuocdznxdspzsdklbkagxkbmmvxpdrsnjcjgdpgjxgavyolbgmedsomwsmdxnmgojpedauuickphpjmppmlgsyercqmdkohoajkuwbkkvdowkhlpjpsimufipsepdwdmcijcrvupexnnpzsgrrnfgzbbkjmjdcdttwospaxpdgqmdskju...
output:
12770 117905 162345 228039 411641 225584 233720 223493 259117 435111 156378 328404 82367 83351 181437 33257 153132 438317 347816 12771 313248 143650 303672 262845 454232 304671 213885 156451 473239 200480 30751 29701 298798 49058 358510 453364 117906 69288 481495 231060 79529 112020 412908 15987 265...
result:
ok 491322 numbers
Test #54:
score: 25
Accepted
time: 0ms
memory: 3688kb
input:
aorkkdwgzumjpimrgnmdvpjqesgj
output:
1 20 6 25 27 17 8 14 28 12 23 5 4 19 11 15 18 2 13 22 24 16 3 26 10 21 7 9
result:
ok 28 numbers
Test #55:
score: 25
Accepted
time: 0ms
memory: 3680kb
input:
oghfjoazbu
output:
7 9 4 2 3 5 6 1 10 8
result:
ok 10 numbers
Test #56:
score: 25
Accepted
time: 22ms
memory: 13548kb
input:
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...
output:
493264 493263 493262 493261 493260 493259 493258 493257 493256 493255 493254 493253 493252 493251 493250 493249 493248 493247 493246 493245 493244 493243 493242 493241 493240 493239 493238 493237 493236 493235 493234 493233 493232 493231 493230 493229 493228 493227 493226 493225 493224 493223 493222...
result:
ok 493264 numbers
Test #57:
score: 25
Accepted
time: 0ms
memory: 3676kb
input:
aaaaa
output:
5 4 3 2 1
result:
ok 5 number(s): "5 4 3 2 1"
Test #58:
score: 25
Accepted
time: 21ms
memory: 13744kb
input:
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk...
output:
494183 494182 494181 494180 494179 494178 494177 494176 494175 494174 494173 494172 494171 494170 494169 494168 494167 494166 494165 494164 494163 494162 494161 494160 494159 494158 494157 494156 494155 494154 494153 494152 494151 494150 494149 494148 494147 494146 494145 494144 494143 494142 494141...
result:
ok 494183 numbers
Test #59:
score: 25
Accepted
time: 0ms
memory: 3964kb
input:
ababacaca
output:
9 1 3 7 5 2 4 8 6
result:
ok 9 numbers
Test #60:
score: 25
Accepted
time: 0ms
memory: 3904kb
input:
azxmfatpffgbmjtuifcvbxplypmzmxphvfhuxrgywmdiespkqnbazctfewcokddkpgmfvwowajtsxgtyiebpjghkrojeiirhxhoi
output:
73 6 52 1 51 12 83 21 59 54 19 62 43 63 82 92 45 57 5 18 56 9 10 34 68 11 86 66 78 39 87 98 35 32 96 100 81 44 17 93 94 91 85 74 14 61 64 48 88 24 42 4 67 13 29 27 50 99 90 60 71 8 65 31 84 47 23 26 49 38 95 89 46 76 55 7 75 15 79 16 36 20 33 69 72 58 41 70 77 97 3 30 22 37 80 25 40 53 28 2
result:
ok 100 numbers