QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#694419 | #7686. The Phantom Menace | maspy | AC ✓ | 838ms | 382412kb | C++23 | 30.1kb | 2024-10-31 17:54:47 | 2024-10-31 17:54:49 |
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/random/base.hpp"
u64 RNG_64() {
static u64 x_ = u64(chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count()) * 10150724397891781847ULL;
x_ ^= x_ << 7;
return x_ ^= x_ >> 9;
}
u64 RNG(u64 lim) { return RNG_64() % lim; }
ll RNG(ll l, ll r) { return l + RNG_64() % (r - l); }
#line 2 "/home/maspy/compro/library/mod/modint61.hpp"
struct modint61 {
static constexpr u64 mod = (1ULL << 61) - 1;
u64 val;
constexpr modint61() : val(0ULL) {}
constexpr modint61(u32 x) : val(x) {}
constexpr modint61(u64 x) : val(x % mod) {}
constexpr modint61(int x) : val((x < 0) ? (x + static_cast<ll>(mod)) : x) {}
constexpr modint61(ll x) : val(((x %= static_cast<ll>(mod)) < 0) ? (x + static_cast<ll>(mod)) : x) {}
static constexpr u64 get_mod() { return mod; }
modint61 &operator+=(const modint61 &a) {
val = ((val += a.val) >= mod) ? (val - mod) : val;
return *this;
}
modint61 &operator-=(const modint61 &a) {
val = ((val -= a.val) >= mod) ? (val + mod) : val;
return *this;
}
modint61 &operator*=(const modint61 &a) {
const unsigned __int128 y = static_cast<unsigned __int128>(val) * a.val;
val = (y >> 61) + (y & mod);
val = (val >= mod) ? (val - mod) : val;
return *this;
}
modint61 operator-() const { return modint61(val ? mod - val : u64(0)); }
modint61 &operator/=(const modint61 &a) { return (*this *= a.inverse()); }
modint61 operator+(const modint61 &p) const { return modint61(*this) += p; }
modint61 operator-(const modint61 &p) const { return modint61(*this) -= p; }
modint61 operator*(const modint61 &p) const { return modint61(*this) *= p; }
modint61 operator/(const modint61 &p) const { return modint61(*this) /= p; }
bool operator<(const modint61 &other) const { return val < other.val; }
bool operator==(const modint61 &p) const { return val == p.val; }
bool operator!=(const modint61 &p) const { return val != p.val; }
modint61 inverse() const {
ll a = val, b = mod, u = 1, v = 0, t;
while (b > 0) {
t = a / b;
swap(a -= t * b, b), swap(u -= t * v, v);
}
return modint61(u);
}
modint61 pow(ll n) const {
assert(n >= 0);
modint61 ret(1), mul(val);
while (n > 0) {
if (n & 1) ret *= mul;
mul *= mul, n >>= 1;
}
return ret;
}
};
#ifdef FASTIO
void rd(modint61 &x) {
fastio::rd(x.val);
assert(0 <= x.val && x.val < modint61::mod);
}
void wt(modint61 x) { fastio::wt(x.val); }
#endif
#line 4 "/home/maspy/compro/library/string/rollinghash.hpp"
struct RollingHash {
using mint = modint61;
static constexpr u64 mod = mint::get_mod();
const mint base;
vc<mint> power;
static inline mint generate_base() { return RNG(mod); }
inline void expand(size_t sz) {
if (power.size() < sz + 1) {
int pre_sz = (int)power.size();
power.resize(sz + 1);
FOR(i, pre_sz - 1, sz) power[i + 1] = power[i] * base;
}
}
explicit RollingHash(mint base = generate_base()) : base(base), power{1} {}
template <typename STRING>
vector<mint> build(const STRING& s) const {
int sz = s.size();
vector<mint> hashed(sz + 1, mint(0));
for (int i = 0; i < sz; i++) { hashed[i + 1] = hashed[i] * base + s[i]; }
return hashed;
}
template <typename STRING>
mint eval(STRING& s) {
mint x = 0;
for (auto& ch: s) x = base * x + ch;
return x;
}
mint query(const vc<mint>& s, int l, int r) {
assert(0 <= l && l <= r && r < len(s));
expand(r - l);
return (s[r] - s[l] * power[r - l]);
}
mint combine(mint h1, mint h2, int h2len) {
expand(h2len);
return h1 * power[h2len] + h2;
}
mint add_char(mint h, int x) { return h * base + mint(x); }
int lcp(const vc<mint>& a, int l1, int r1, const vc<mint>& b, int l2,
int r2) {
int len = min(r1 - l1, r2 - l2);
int low = 0, high = len + 1;
while (high - low > 1) {
int mid = (low + high) / 2;
if (query(a, l1, l1 + mid) == query(b, l2, l2 + mid))
low = mid;
else
high = mid;
}
return low;
}
};
#line 2 "/home/maspy/compro/library/ds/hashmap.hpp"
// u64 -> Val
template <typename Val>
struct HashMap {
// n は入れたいものの個数で ok
HashMap(u32 n = 0) { build(n); }
void build(u32 n) {
u32 k = 8;
while (k < n * 2) k *= 2;
cap = k / 2, mask = k - 1;
key.resize(k), val.resize(k), used.assign(k, 0);
}
// size を保ったまま. size=0 にするときは build すること.
void clear() {
used.assign(len(used), 0);
cap = (mask + 1) / 2;
}
int size() { return len(used) / 2 - cap; }
int index(const u64& k) {
int i = 0;
for (i = hash(k); used[i] && key[i] != k; i = (i + 1) & mask) {}
return i;
}
Val& operator[](const u64& k) {
if (cap == 0) extend();
int i = index(k);
if (!used[i]) { used[i] = 1, key[i] = k, val[i] = Val{}, --cap; }
return val[i];
}
Val get(const u64& k, Val default_value) {
int i = index(k);
return (used[i] ? val[i] : default_value);
}
bool count(const u64& k) {
int i = index(k);
return used[i] && key[i] == k;
}
// f(key, val)
template <typename F>
void enumerate_all(F f) {
FOR(i, len(used)) if (used[i]) f(key[i], val[i]);
}
private:
u32 cap, mask;
vc<u64> key;
vc<Val> val;
vc<bool> used;
u64 hash(u64 x) {
static const u64 FIXED_RANDOM = std::chrono::steady_clock::now().time_since_epoch().count();
x += FIXED_RANDOM;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return (x ^ (x >> 31)) & mask;
}
void extend() {
vc<pair<u64, Val>> dat;
dat.reserve(len(used) / 2 - cap);
FOR(i, len(used)) {
if (used[i]) dat.eb(key[i], val[i]);
}
build(2 * len(dat));
for (auto& [a, b]: dat) (*this)[a] = b;
}
};
#line 2 "/home/maspy/compro/library/ds/to_small_key.hpp"
// [30,10,20,30] -> [0,1,2,0] etc.
struct To_Small_Key {
int kind = 0;
HashMap<int> MP;
To_Small_Key(u32 n = 0) : MP(n) {}
void reserve(u32 n) { MP.build(n); }
int size() { return MP.size(); }
int set_key(u64 x) {
if (!MP.count(x)) MP[x] = kind++;
return MP[x];
}
int query(u64 x) { return MP.get(x, -1); }
};
#line 2 "/home/maspy/compro/library/ds/unionfind/unionfind.hpp"
struct UnionFind {
int n, n_comp;
vc<int> dat; // par or (-size)
UnionFind(int n = 0) { build(n); }
void build(int m) {
n = m, n_comp = m;
dat.assign(n, -1);
}
void reset() { build(n); }
int operator[](int x) {
while (dat[x] >= 0) {
int pp = dat[dat[x]];
if (pp < 0) { return dat[x]; }
x = dat[x] = pp;
}
return x;
}
ll size(int x) {
x = (*this)[x];
return -dat[x];
}
bool merge(int x, int y) {
x = (*this)[x], y = (*this)[y];
if (x == y) return false;
if (-dat[x] < -dat[y]) swap(x, y);
dat[x] += dat[y], dat[y] = x, n_comp--;
return true;
}
vc<int> get_all() {
vc<int> A(n);
FOR(i, n) A[i] = (*this)[i];
return A;
}
};
#line 2 "/home/maspy/compro/library/graph/base.hpp"
template <typename T>
struct Edge {
int frm, to;
T cost;
int id;
};
template <typename T = int, bool directed = false>
struct Graph {
static constexpr bool is_directed = directed;
int N, M;
using cost_type = T;
using edge_type = Edge<T>;
vector<edge_type> edges;
vector<int> indptr;
vector<edge_type> csr_edges;
vc<int> vc_deg, vc_indeg, vc_outdeg;
bool prepared;
class OutgoingEdges {
public:
OutgoingEdges(const Graph* G, int l, int r) : G(G), l(l), r(r) {}
const edge_type* begin() const {
if (l == r) { return 0; }
return &G->csr_edges[l];
}
const edge_type* end() const {
if (l == r) { return 0; }
return &G->csr_edges[r];
}
private:
const Graph* G;
int l, r;
};
bool is_prepared() { return prepared; }
Graph() : N(0), M(0), prepared(0) {}
Graph(int N) : N(N), M(0), prepared(0) {}
void build(int n) {
N = n, M = 0;
prepared = 0;
edges.clear();
indptr.clear();
csr_edges.clear();
vc_deg.clear();
vc_indeg.clear();
vc_outdeg.clear();
}
void add(int frm, int to, T cost = 1, int i = -1) {
assert(!prepared);
assert(0 <= frm && 0 <= to && to < N);
if (i == -1) i = M;
auto e = edge_type({frm, to, cost, i});
edges.eb(e);
++M;
}
#ifdef FASTIO
// wt, off
void read_tree(bool wt = false, int off = 1) { read_graph(N - 1, wt, off); }
void read_graph(int M, bool wt = false, int off = 1) {
for (int m = 0; m < M; ++m) {
INT(a, b);
a -= off, b -= off;
if (!wt) {
add(a, b);
} else {
T c;
read(c);
add(a, b, c);
}
}
build();
}
#endif
void build() {
assert(!prepared);
prepared = true;
indptr.assign(N + 1, 0);
for (auto&& e: edges) {
indptr[e.frm + 1]++;
if (!directed) indptr[e.to + 1]++;
}
for (int v = 0; v < N; ++v) { indptr[v + 1] += indptr[v]; }
auto counter = indptr;
csr_edges.resize(indptr.back() + 1);
for (auto&& e: edges) {
csr_edges[counter[e.frm]++] = e;
if (!directed)
csr_edges[counter[e.to]++] = edge_type({e.to, e.frm, e.cost, e.id});
}
}
OutgoingEdges operator[](int v) const {
assert(prepared);
return {this, indptr[v], indptr[v + 1]};
}
vc<int> deg_array() {
if (vc_deg.empty()) calc_deg();
return vc_deg;
}
pair<vc<int>, vc<int>> deg_array_inout() {
if (vc_indeg.empty()) calc_deg_inout();
return {vc_indeg, vc_outdeg};
}
int deg(int v) {
if (vc_deg.empty()) calc_deg();
return vc_deg[v];
}
int in_deg(int v) {
if (vc_indeg.empty()) calc_deg_inout();
return vc_indeg[v];
}
int out_deg(int v) {
if (vc_outdeg.empty()) calc_deg_inout();
return vc_outdeg[v];
}
#ifdef FASTIO
void debug() {
print("Graph");
if (!prepared) {
print("frm to cost id");
for (auto&& e: edges) print(e.frm, e.to, e.cost, e.id);
} else {
print("indptr", indptr);
print("frm to cost id");
FOR(v, N) for (auto&& e: (*this)[v]) print(e.frm, e.to, e.cost, e.id);
}
}
#endif
vc<int> new_idx;
vc<bool> used_e;
// G における頂点 V[i] が、新しいグラフで i になるようにする
// {G, es}
// sum(deg(v)) の計算量になっていて、
// 新しいグラフの n+m より大きい可能性があるので注意
Graph<T, directed> rearrange(vc<int> V, bool keep_eid = 0) {
if (len(new_idx) != N) new_idx.assign(N, -1);
int n = len(V);
FOR(i, n) new_idx[V[i]] = i;
Graph<T, directed> G(n);
vc<int> history;
FOR(i, n) {
for (auto&& e: (*this)[V[i]]) {
if (len(used_e) <= e.id) used_e.resize(e.id + 1);
if (used_e[e.id]) continue;
int a = e.frm, b = e.to;
if (new_idx[a] != -1 && new_idx[b] != -1) {
history.eb(e.id);
used_e[e.id] = 1;
int eid = (keep_eid ? e.id : -1);
G.add(new_idx[a], new_idx[b], e.cost, eid);
}
}
}
FOR(i, n) new_idx[V[i]] = -1;
for (auto&& eid: history) used_e[eid] = 0;
G.build();
return G;
}
Graph<T, true> to_directed_tree(int root = -1) {
if (root == -1) root = 0;
assert(!is_directed && prepared && M == N - 1);
Graph<T, true> G1(N);
vc<int> par(N, -1);
auto dfs = [&](auto& dfs, int v) -> void {
for (auto& e: (*this)[v]) {
if (e.to == par[v]) continue;
par[e.to] = v, dfs(dfs, e.to);
}
};
dfs(dfs, root);
for (auto& e: edges) {
int a = e.frm, b = e.to;
if (par[a] == b) swap(a, b);
assert(par[b] == a);
G1.add(a, b, e.cost);
}
G1.build();
return G1;
}
private:
void calc_deg() {
assert(vc_deg.empty());
vc_deg.resize(N);
for (auto&& e: edges) vc_deg[e.frm]++, vc_deg[e.to]++;
}
void calc_deg_inout() {
assert(vc_indeg.empty());
vc_indeg.resize(N);
vc_outdeg.resize(N);
for (auto&& e: edges) { vc_indeg[e.to]++, vc_outdeg[e.frm]++; }
}
};
#line 2 "/home/maspy/compro/library/graph/vs_to_es.hpp"
#line 4 "/home/maspy/compro/library/graph/vs_to_es.hpp"
template <typename GT>
vc<int> vs_to_es(GT& G, vc<int>& vs, bool allow_use_twice = false) {
assert(!vs.empty());
HashMap<int> MP(G.M);
vc<int> nxt(G.M, -1);
auto get = [&](ll a, ll b) -> u64 {
if (!GT::is_directed && a > b) swap(a, b);
return a * G.N + b;
};
FOR(eid, G.M) {
u64 k = get(G.edges[eid].frm, G.edges[eid].to);
int x = MP.get(k, -1);
nxt[eid] = x, MP[k] = eid;
}
int n = len(vs);
vc<int> es(n - 1);
FOR(i, n - 1) {
u64 k = get(vs[i], vs[i + 1]);
int eid = MP.get(k, -1);
assert(eid != -1);
es[i] = eid;
if (!allow_use_twice) { MP[k] = nxt[eid]; }
}
return es;
}
#line 4 "/home/maspy/compro/library/graph/eulerwalk.hpp"
// (vs, es) or empty
template <typename GT>
pair<vc<int>, vc<int>> euler_walk(GT& G, int s = -1) {
const int N = G.N, M = G.M;
assert(G.is_prepared());
assert(N > 0);
if (s == -1) {
vc<int> deg(N);
for (auto&& e: G.edges) {
if constexpr (GT::is_directed) {
deg[e.frm]++, deg[e.to]--;
} else {
deg[e.frm]++, deg[e.to]++;
}
}
if constexpr (GT::is_directed) {
s = max_element(all(deg)) - deg.begin();
if (deg[s] == 0) s = (M == 0 ? 0 : G.edges[0].frm);
} else {
s = [&]() -> int {
FOR(v, N) if (deg[v] & 1) return v;
return (M == 0 ? 0 : G.edges[0].frm);
}();
}
}
if (M == 0) return {{s}, {}};
vc<int> D(N), its(N), eu(M), vs, st = {s};
FOR(v, N) its[v] = G.indptr[v];
++D[s];
while (!st.empty()) {
int x = st.back(), y, e, &it = its[x], end = G.indptr[x + 1];
if (it == end) {
vs.eb(x);
st.pop_back();
continue;
}
auto& ee = G.csr_edges[it++];
y = ee.to, e = ee.id;
if (!eu[e]) {
D[x]--, D[y]++;
eu[e] = 1;
st.eb(y);
}
}
for (auto&& x: D)
if (x < 0) return {{}, {}};
if (len(vs) != M + 1) return {{}, {}};
reverse(all(vs));
auto es = vs_to_es(G, vs, false);
return {vs, es};
}
template <typename GT>
bool has_euler_walk(GT& G, int s = -1) {
int N = G.N, M = G.M;
if (M == 0) return true;
if constexpr (!GT::is_directed) {
vc<int> odd(N);
for (auto& e: G.edges) odd[e.frm] ^= 1, odd[e.to] ^= 1;
int n_odd = 0;
for (auto x: odd) n_odd += x;
if (n_odd >= 4) return false;
if (s != -1 && n_odd == 2 && !odd[s]) return false;
UnionFind uf(N);
for (auto& e: G.edges) uf.merge(e.frm, e.to);
vector<int> cnt_edge(N);
for (auto& e: G.edges) cnt_edge[uf[e.frm]]++;
if (s != -1 && cnt_edge[uf[s]] == 0) return false;
// 辺がある成分を数える
int nc = 0;
for (int v = 0; v < N; ++v) {
if (uf[v] == v && cnt_edge[v] >= 1) ++nc;
}
return nc <= 1;
} else {
int N = G.N;
vc<int> in(N), out(N);
for (auto& e: G.edges) out[e.frm]++, in[e.to]++;
int ng = 0;
FOR(v, N) ng += abs(out[v] - in[v]);
if (ng >= 4) return false;
if (s != -1 && ng == 2 && out[s] != in[s] + 1) return false;
UnionFind uf(N);
for (auto& e: G.edges) uf.merge(e.frm, e.to);
vector<int> cnt_edge(N);
for (auto& e: G.edges) cnt_edge[uf[e.frm]]++;
if (s != -1 && cnt_edge[uf[s]] == 0) return false;
// 辺がある成分を数える
int nc = 0;
for (int v = 0; v < N; ++v) {
if (uf[v] == v && cnt_edge[v] >= 1) ++nc;
}
return nc <= 1;
}
}
#line 7 "main.cpp"
void solve() {
LL(N, M);
VEC(string, dat, 2 * N);
RollingHash RH;
using mint = decltype(RH)::mint;
vvc<mint> SH(2 * N);
FOR(i, 2 * N) SH[i] = RH.build(dat[i]);
FOR(k, M) {
To_Small_Key IDX;
Graph<int, 1> G(4 * N);
FOR(i, N) {
int a = IDX.set_key(2 * RH.query(SH[i], 0, k).val + 0);
int b = IDX.set_key(2 * RH.query(SH[i], k, M).val + 1);
G.add(a, b);
}
FOR(i, N, 2 * N) {
int a = IDX.set_key(2 * RH.query(SH[i], 0, M - k).val + 1);
int b = IDX.set_key(2 * RH.query(SH[i], M - k, M).val + 0);
G.add(a, b);
}
G.build();
// if (k == 1) G.debug();
auto [vs, es] = euler_walk(G);
if (vs.empty()) continue;
if (vs[0] != vs.back()) continue;
vc<int> P, Q;
for (auto& e: es) {
if (e < N) P.eb(e + 1);
if (e >= N) Q.eb(e - N + 1);
}
print(P);
print(Q);
return;
}
print(-1);
}
signed main() {
INT(T);
FOR(T) solve();
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3664kb
input:
2 3 3 abc ghi def bcd efg hia 1 3 abc def
output:
1 3 2 1 2 3 -1
result:
ok 2 cases (2 test cases)
Test #2:
score: 0
Accepted
time: 838ms
memory: 4160kb
input:
1000000 1 1 b b 1 1 a b 1 1 b a 1 1 a a 1 1 b b 1 1 a b 1 1 b a 1 1 a a 1 1 b b 1 1 a b 1 1 b a 1 1 a a 1 1 b b 1 1 a b 1 1 b a 1 1 a a 1 1 b b 1 1 a b 1 1 b a 1 1 a a 1 1 b b 1 1 a b 1 1 b a 1 1 a a 1 1 b b 1 1 a b 1 1 b a 1 1 a a 1 1 b b 1 1 a b 1 1 b a 1 1 a a 1 1 b b 1 1 a b 1 1 b a 1 1 a a 1 1 ...
output:
1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 1 -1...
result:
ok 1000000 cases (1000000 test cases)
Test #3:
score: 0
Accepted
time: 730ms
memory: 3904kb
input:
500000 1 2 dd ba 1 2 cd ba 1 2 bd ba 1 2 ad ba 1 2 dc ba 1 2 cc ba 1 2 bc ba 1 2 ac ba 1 2 db ba 1 2 cb ba 1 2 bb ba 1 2 ab ba 1 2 da ba 1 2 ca ba 1 2 ba ba 1 2 aa ba 1 2 dd aa 1 2 cd aa 1 2 bd aa 1 2 ad aa 1 2 dc aa 1 2 cc aa 1 2 bc aa 1 2 ac aa 1 2 db aa 1 2 cb aa 1 2 bb aa 1 2 ab aa 1 2 da aa 1 2...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1...
result:
ok 500000 cases (500000 test cases)
Test #4:
score: 0
Accepted
time: 551ms
memory: 3916kb
input:
500000 2 1 d d b a 2 1 c d b a 2 1 b d b a 2 1 a d b a 2 1 d c b a 2 1 c c b a 2 1 b c b a 2 1 a c b a 2 1 d b b a 2 1 c b b a 2 1 b b b a 2 1 a b b a 2 1 d a b a 2 1 c a b a 2 1 b a b a 2 1 a a b a 2 1 d d a a 2 1 c d a a 2 1 b d a a 2 1 a d a a 2 1 d c a a 2 1 c c a a 2 1 b c a a 2 1 a c a a 2 1 d...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 2 2 1 -1 -1 1 2 1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 1 2 1 2 1 2 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 2 1 2 -1 -1 1 2 2 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 2 1 2 -1 -1 -1 -1 -1 1 2 2 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 2 1 2 -1 ...
result:
ok 500000 cases (500000 test cases)
Test #5:
score: 0
Accepted
time: 657ms
memory: 3968kb
input:
333333 1 3 cbb bfa 1 3 bbb bfa 1 3 abb bfa 1 3 fab bfa 1 3 eab bfa 1 3 dab bfa 1 3 cab bfa 1 3 bab bfa 1 3 aab bfa 1 3 ffa bfa 1 3 efa bfa 1 3 dfa bfa 1 3 cfa bfa 1 3 bfa bfa 1 3 afa bfa 1 3 fea bfa 1 3 eea bfa 1 3 dea bfa 1 3 cea bfa 1 3 bea bfa 1 3 aea bfa 1 3 fda bfa 1 3 eda bfa 1 3 dda bfa 1 3 c...
output:
-1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 333333 cases (333333 test cases)
Test #6:
score: 0
Accepted
time: 403ms
memory: 3900kb
input:
333333 3 1 c b b b f a 3 1 b b b b f a 3 1 a b b b f a 3 1 f a b b f a 3 1 e a b b f a 3 1 d a b b f a 3 1 c a b b f a 3 1 b a b b f a 3 1 a a b b f a 3 1 f f a b f a 3 1 e f a b f a 3 1 d f a b f a 3 1 c f a b f a 3 1 b f a b f a 3 1 a f a b f a 3 1 f e a b f a 3 1 e e a b f a 3 1 d e a b f a 3 1 c...
output:
-1 -1 -1 1 2 3 2 3 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 2 3 1 2 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 2 3 2 1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 1 3 3 1 2 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 333333 cases (333333 test cases)
Test #7:
score: 0
Accepted
time: 640ms
memory: 4196kb
input:
250000 1 4 hbca fhaa 1 4 gbca fhaa 1 4 fbca fhaa 1 4 ebca fhaa 1 4 dbca fhaa 1 4 cbca fhaa 1 4 bbca fhaa 1 4 abca fhaa 1 4 haca fhaa 1 4 gaca fhaa 1 4 faca fhaa 1 4 eaca fhaa 1 4 daca fhaa 1 4 caca fhaa 1 4 baca fhaa 1 4 aaca fhaa 1 4 hhba fhaa 1 4 ghba fhaa 1 4 fhba fhaa 1 4 ehba fhaa 1 4 dhba fhaa...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
result:
ok 250000 cases (250000 test cases)
Test #8:
score: 0
Accepted
time: 319ms
memory: 3976kb
input:
250000 4 1 h b c a f h a a 4 1 g b c a f h a a 4 1 f b c a f h a a 4 1 e b c a f h a a 4 1 d b c a f h a a 4 1 c b c a f h a a 4 1 b b c a f h a a 4 1 a b c a f h a a 4 1 h a c a f h a a 4 1 g a c a f h a a 4 1 f a c a f h a a 4 1 e a c a f h a a 4 1 d a c a f h a a 4 1 c a c a f h a a 4 1 b a c a f...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 2 4 3 1 2 4 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
result:
ok 250000 cases (250000 test cases)
Test #9:
score: 0
Accepted
time: 624ms
memory: 3968kb
input:
200000 1 5 jjjjj baaaa 1 5 ijjjj baaaa 1 5 hjjjj baaaa 1 5 gjjjj baaaa 1 5 fjjjj baaaa 1 5 ejjjj baaaa 1 5 djjjj baaaa 1 5 cjjjj baaaa 1 5 bjjjj baaaa 1 5 ajjjj baaaa 1 5 jijjj baaaa 1 5 iijjj baaaa 1 5 hijjj baaaa 1 5 gijjj baaaa 1 5 fijjj baaaa 1 5 eijjj baaaa 1 5 dijjj baaaa 1 5 cijjj baaaa 1 5 b...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 200000 cases (200000 test cases)
Test #10:
score: 0
Accepted
time: 288ms
memory: 3900kb
input:
200000 5 1 j j j j j b a a a a 5 1 i j j j j b a a a a 5 1 h j j j j b a a a a 5 1 g j j j j b a a a a 5 1 f j j j j b a a a a 5 1 e j j j j b a a a a 5 1 d j j j j b a a a a 5 1 c j j j j b a a a a 5 1 b j j j j b a a a a 5 1 a j j j j b a a a a 5 1 j i j j j b a a a a 5 1 i i j j j b a a a a 5 1 h...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 200000 cases (200000 test cases)
Test #11:
score: 0
Accepted
time: 416ms
memory: 3904kb
input:
250000 2 2 hb ca fh aa 2 2 gb ca fh aa 2 2 fb ca fh aa 2 2 eb ca fh aa 2 2 db ca fh aa 2 2 cb ca fh aa 2 2 bb ca fh aa 2 2 ab ca fh aa 2 2 ha ca fh aa 2 2 ga ca fh aa 2 2 fa ca fh aa 2 2 ea ca fh aa 2 2 da ca fh aa 2 2 ca ca fh aa 2 2 ba ca fh aa 2 2 aa ca fh aa 2 2 hh ba fh aa 2 2 gh ba fh aa 2 2 f...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 2 1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
result:
ok 250000 cases (250000 test cases)
Test #12:
score: 0
Accepted
time: 385ms
memory: 3968kb
input:
166666 2 3 jef aia aaa aaa 2 3 ief aia aaa aaa 2 3 hef aia aaa aaa 2 3 gef aia aaa aaa 2 3 fef aia aaa aaa 2 3 eef aia aaa aaa 2 3 def aia aaa aaa 2 3 cef aia aaa aaa 2 3 bef aia aaa aaa 2 3 aef aia aaa aaa 2 3 ldf aia aaa aaa 2 3 kdf aia aaa aaa 2 3 jdf aia aaa aaa 2 3 idf aia aaa aaa 2 3 hdf aia a...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 166666 cases (166666 test cases)
Test #13:
score: 0
Accepted
time: 315ms
memory: 3916kb
input:
166666 3 2 je fa ia aa aa aa 3 2 ie fa ia aa aa aa 3 2 he fa ia aa aa aa 3 2 ge fa ia aa aa aa 3 2 fe fa ia aa aa aa 3 2 ee fa ia aa aa aa 3 2 de fa ia aa aa aa 3 2 ce fa ia aa aa aa 3 2 be fa ia aa aa aa 3 2 ae fa ia aa aa aa 3 2 ld fa ia aa aa aa 3 2 kd fa ia aa aa aa 3 2 jd fa ia aa aa aa 3 2 id ...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 166666 cases (166666 test cases)
Test #14:
score: 0
Accepted
time: 373ms
memory: 3908kb
input:
125000 2 4 heio baaa aaaa aaaa 2 4 geio baaa aaaa aaaa 2 4 feio baaa aaaa aaaa 2 4 eeio baaa aaaa aaaa 2 4 deio baaa aaaa aaaa 2 4 ceio baaa aaaa aaaa 2 4 beio baaa aaaa aaaa 2 4 aeio baaa aaaa aaaa 2 4 pdio baaa aaaa aaaa 2 4 odio baaa aaaa aaaa 2 4 ndio baaa aaaa aaaa 2 4 mdio baaa aaaa aaaa 2 4 l...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 125000 cases (125000 test cases)
Test #15:
score: 0
Accepted
time: 274ms
memory: 4192kb
input:
125000 4 2 he io ba aa aa aa aa aa 4 2 ge io ba aa aa aa aa aa 4 2 fe io ba aa aa aa aa aa 4 2 ee io ba aa aa aa aa aa 4 2 de io ba aa aa aa aa aa 4 2 ce io ba aa aa aa aa aa 4 2 be io ba aa aa aa aa aa 4 2 ae io ba aa aa aa aa aa 4 2 pd io ba aa aa aa aa aa 4 2 od io ba aa aa aa aa aa 4 2 nd io ba ...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 125000 cases (125000 test cases)
Test #16:
score: 0
Accepted
time: 388ms
memory: 3888kb
input:
100000 2 5 ttjma aaaaa aaaaa aaaaa 2 5 stjma aaaaa aaaaa aaaaa 2 5 rtjma aaaaa aaaaa aaaaa 2 5 qtjma aaaaa aaaaa aaaaa 2 5 ptjma aaaaa aaaaa aaaaa 2 5 otjma aaaaa aaaaa aaaaa 2 5 ntjma aaaaa aaaaa aaaaa 2 5 mtjma aaaaa aaaaa aaaaa 2 5 ltjma aaaaa aaaaa aaaaa 2 5 ktjma aaaaa aaaaa aaaaa 2 5 jtjma aaa...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 100000 cases (100000 test cases)
Test #17:
score: 0
Accepted
time: 245ms
memory: 3968kb
input:
100000 5 2 tt jm aa aa aa aa aa aa aa aa 5 2 st jm aa aa aa aa aa aa aa aa 5 2 rt jm aa aa aa aa aa aa aa aa 5 2 qt jm aa aa aa aa aa aa aa aa 5 2 pt jm aa aa aa aa aa aa aa aa 5 2 ot jm aa aa aa aa aa aa aa aa 5 2 nt jm aa aa aa aa aa aa aa aa 5 2 mt jm aa aa aa aa aa aa aa aa 5 2 lt jm aa aa aa aa...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 100000 cases (100000 test cases)
Test #18:
score: 0
Accepted
time: 296ms
memory: 3856kb
input:
111111 3 3 oqa bba aaa aaa aaa aaa 3 3 nqa bba aaa aaa aaa aaa 3 3 mqa bba aaa aaa aaa aaa 3 3 lqa bba aaa aaa aaa aaa 3 3 kqa bba aaa aaa aaa aaa 3 3 jqa bba aaa aaa aaa aaa 3 3 iqa bba aaa aaa aaa aaa 3 3 hqa bba aaa aaa aaa aaa 3 3 gqa bba aaa aaa aaa aaa 3 3 fqa bba aaa aaa aaa aaa 3 3 eqa bba a...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 111111 cases (111111 test cases)
Test #19:
score: 0
Accepted
time: 292ms
memory: 3908kb
input:
83333 3 4 eqag aaaa aaaa aaaa aaaa aaaa 3 4 dqag aaaa aaaa aaaa aaaa aaaa 3 4 cqag aaaa aaaa aaaa aaaa aaaa 3 4 bqag aaaa aaaa aaaa aaaa aaaa 3 4 aqag aaaa aaaa aaaa aaaa aaaa 3 4 xpag aaaa aaaa aaaa aaaa aaaa 3 4 wpag aaaa aaaa aaaa aaaa aaaa 3 4 vpag aaaa aaaa aaaa aaaa aaaa 3 4 upag aaaa aaaa aaa...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 83333 cases (83333 test cases)
Test #20:
score: 0
Accepted
time: 243ms
memory: 4200kb
input:
83333 4 3 eqa gaa aaa aaa aaa aaa aaa aaa 4 3 dqa gaa aaa aaa aaa aaa aaa aaa 4 3 cqa gaa aaa aaa aaa aaa aaa aaa 4 3 bqa gaa aaa aaa aaa aaa aaa aaa 4 3 aqa gaa aaa aaa aaa aaa aaa aaa 4 3 xpa gaa aaa aaa aaa aaa aaa aaa 4 3 wpa gaa aaa aaa aaa aaa aaa aaa 4 3 vpa gaa aaa aaa aaa aaa aaa aaa 4 3 up...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 83333 cases (83333 test cases)
Test #21:
score: 0
Accepted
time: 345ms
memory: 3976kb
input:
66666 3 5 bquda aaaaa aaaaa aaaaa aaaaa aaaaa 3 5 aquda aaaaa aaaaa aaaaa aaaaa aaaaa 3 5 zpuda aaaaa aaaaa aaaaa aaaaa aaaaa 3 5 ypuda aaaaa aaaaa aaaaa aaaaa aaaaa 3 5 xpuda aaaaa aaaaa aaaaa aaaaa aaaaa 3 5 wpuda aaaaa aaaaa aaaaa aaaaa aaaaa 3 5 vpuda aaaaa aaaaa aaaaa aaaaa aaaaa 3 5 upuda aaaa...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 66666 cases (66666 test cases)
Test #22:
score: 0
Accepted
time: 216ms
memory: 3968kb
input:
66666 5 3 bqu daa aaa aaa aaa aaa aaa aaa aaa aaa 5 3 aqu daa aaa aaa aaa aaa aaa aaa aaa aaa 5 3 zpu daa aaa aaa aaa aaa aaa aaa aaa aaa 5 3 ypu daa aaa aaa aaa aaa aaa aaa aaa aaa 5 3 xpu daa aaa aaa aaa aaa aaa aaa aaa aaa 5 3 wpu daa aaa aaa aaa aaa aaa aaa aaa aaa 5 3 vpu daa aaa aaa aaa aaa aa...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 66666 cases (66666 test cases)
Test #23:
score: 0
Accepted
time: 227ms
memory: 3904kb
input:
20833 6 8 gvebaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa 6 8 fvebaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa 6 8 evebaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaa...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 20833 cases (20833 test cases)
Test #24:
score: 0
Accepted
time: 204ms
memory: 3892kb
input:
15873 9 7 mmxaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa 9 7 lmxaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaa...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 15873 cases (15873 test cases)
Test #25:
score: 0
Accepted
time: 192ms
memory: 4068kb
input:
10000 10 10 puoaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa 10 10 ouoaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaa...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 10000 cases (10000 test cases)
Test #26:
score: 0
Accepted
time: 411ms
memory: 4004kb
input:
250000 2 2 od ah ha do 2 2 il ng il ng 2 2 cf pf pf cf 2 2 wx ll wx ll 2 2 fg ge ge fg 2 2 dg mj dg mj 2 2 rj vw wr jv 2 2 er pv pv er 2 2 kc lb cl bk 2 2 dh zc hz cd 2 2 qv ce eq vc 2 2 lz um zu ml 2 2 hw xx hw xx 2 2 uk un ku nu 2 2 sg kx gs xk 2 2 ib xw ib xw 2 2 ar pd pd ar 2 2 ij si ii js 2 2 p...
output:
-1 1 2 1 2 1 2 2 1 1 2 1 2 1 2 2 1 1 2 1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 1 2 1 2 2 1 1 2 1 2 1 2 1 2 1 2 1 2 -1 1 2 1 2 1 2 2 1 1 2 2 1 1 2 2 1 1 2 1 2 -1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 1 2 1 2 1 2 1 2 1 2 -1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 -1 1 2 1 2 1 2 1 2 1 2 2 1 1 2 2 1 -1 1 2 2 1 1 2 1 2 -1...
result:
ok 250000 cases (250000 test cases)
Test #27:
score: 0
Accepted
time: 369ms
memory: 4208kb
input:
166666 2 3 aib avi aib avi 2 3 btw xjw xjw btw 2 3 dng ouv uvd ngo 2 3 ctq sve sve ctq 2 3 ott obm ott obm 2 3 aly tmx aly tmx 2 3 nhm zar arn hmz 2 3 knr qpa nrq pak 2 3 gsw fyn sng ywf 2 3 qcy rov qcy rov 2 3 nmj tyx tyx nmj 2 3 dbu pim pim dbu 2 3 afj zwf ffa wjz 2 3 vgo sky gyv kos 2 3 zru bog u...
output:
1 2 1 2 1 2 2 1 1 2 2 1 1 2 2 1 1 2 1 2 1 2 1 2 1 2 2 1 1 2 1 2 -1 1 2 1 2 1 2 2 1 1 2 2 1 -1 -1 -1 -1 1 2 1 2 -1 1 2 1 2 1 2 1 2 -1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 1 2 1 2 1 2 1 2 1 2 1 2 -1 1 2 1 2 1 2 1 2 1 2 2 1 1 2 1 2 1 2 1 2 -1 1 2 1 2 1 2 2 1 -1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 1 2 -1 1 2...
result:
ok 166666 cases (166666 test cases)
Test #28:
score: 0
Accepted
time: 327ms
memory: 3940kb
input:
166666 3 2 yx pd tl dt xy lp 3 2 xb pc cr xb pc cr 3 2 bw bl so bw bl so 3 2 oq eu tx eu oq tx 3 2 tk ul ep le kt pu 3 2 ze en iq qe ei nz 3 2 zn vd nz nv zn dz 3 2 sn aa sl aa sn sl 3 2 cn lx jn cn lx jn 3 2 il td rf rf td il 3 2 up mr ex ru xe pm 3 2 pk vn pk pk vn pk 3 2 ke vj cp ke cp vj 3 2 aq ...
output:
-1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 2 1 3 -1 1 3 2 2 1 3 -1 1 2 3 2 1 3 1 2 3 1 2 3 1 2 3 3 2 1 -1 3 2 1 3 2 1 1 2 3 1 3 2 1 2 3 1 3 2 1 3 2 1 3 2 1 2 3 1 2 3 1 2 3 3 2 1 1 2 3 3 1 2 1 2 3 2 3 1 1 2 3 3 2 1 1 3 2 2 3 1 1 3 2 3 2 1 1 2 3 2 1 3 1 2 3 3 2 1 1 2 3 2 3 1 -1 1 2 3 3 2 1 1 2 3 2 3 1 1 2 3 2 3...
result:
ok 166666 cases (166666 test cases)
Test #29:
score: 0
Accepted
time: 388ms
memory: 3976kb
input:
125000 8 1 b j r k f e h g f g h e r j b k 8 1 v d t w h h k o w v d h k h o t 8 1 s u k a a v i d a d v u s a k i 8 1 j l p m z o s f z o f l m p s j 8 1 h v s i j d a w d i j s w a h v 8 1 a h a e b w m l e l a m a h w b 8 1 q f y l s m d c c f d q y l s m 8 1 q c o k n a v w k q v n c a o w 8 1 f...
output:
1 2 3 4 5 6 7 8 7 6 5 8 1 4 3 2 1 2 3 4 6 5 7 8 2 3 8 1 6 4 5 7 1 2 3 5 4 6 7 8 5 4 7 6 1 3 8 2 1 2 3 4 5 6 7 8 8 4 6 5 1 2 7 3 1 2 3 4 5 6 7 8 7 8 4 2 3 1 6 5 3 2 1 4 5 6 7 8 5 6 3 1 8 7 4 2 1 2 3 4 5 6 7 8 4 2 5 6 7 8 3 1 1 2 3 4 5 6 7 8 2 5 7 1 4 6 3 8 1 2 3 4 5 6 7 8 2 8 6 4 1 5 3 7 6 2 3 4 5 1 ...
result:
ok 125000 cases (125000 test cases)
Test #30:
score: 0
Accepted
time: 484ms
memory: 4196kb
input:
100000 1 10 klhmhvkswy wykjhmhvks 1 10 uqieigoabd qieigoabdu 1 10 bunljqpvov vbunljqivo 1 10 ytkmhxtntc xtntcytkmh 1 10 lufmlhxbvz ufmlcxbvzl 1 10 cuemsefukn sefukncueq 1 10 oomyzzliuk zzliukoomy 1 10 piekrxtsag rxtsagpiek 1 10 pwhbveolnf nfpwhbveol 1 10 wsyjzqnbtj jzqnbojwsy 1 10 iqayiqecea aiqaytq...
output:
-1 1 1 -1 1 1 -1 -1 1 1 1 1 1 1 -1 -1 1 1 -1 -1 1 1 1 1 -1 1 1 -1 -1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 -1 -1 1 1 -1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 -1 1 1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 1 1 -1 1 1 1 1 -1 -1 -1 -1 -1 1 1 -1 -1 -...
result:
ok 100000 cases (100000 test cases)
Test #31:
score: 0
Accepted
time: 233ms
memory: 3856kb
input:
28571 7 5 rpdbr kijbw qotha wvxmn frbey tdjed vqpoy havot bwfrb edrpd mnkij eyqqp oytdj brwvx 7 5 pecul iozuk kxkfg ivcha erold abatw otvoe otvoe kxkfg abatw ivcha pecul erold iozuk 7 5 qmwhz odnhu dkzle roeec xftep axzal kgusp ecdgu huxft epqmw lekkz alroe hzaxz spodn 7 5 aefno popfk shavv cvhdy na...
output:
-1 1 2 3 4 5 6 7 5 7 2 4 6 3 1 -1 1 7 4 6 3 5 2 5 4 6 1 7 2 3 -1 1 3 2 6 4 5 7 2 4 6 1 3 5 7 1 6 3 2 4 5 7 4 3 7 6 5 2 1 -1 1 2 3 4 5 6 7 7 2 4 6 3 1 5 -1 -1 1 3 6 7 2 4 5 3 2 7 1 5 4 6 1 7 3 5 6 4 2 7 1 5 3 6 2 4 -1 1 3 7 5 2 4 6 2 5 7 3 4 6 1 1 2 3 4 5 6 7 1 3 5 6 2 4 7 1 2 6 5 3 7 4 1 4 2 6 7 5 3...
result:
ok 28571 cases (28571 test cases)
Test #32:
score: 0
Accepted
time: 236ms
memory: 23552kb
input:
1 1000 1000 plxpgukngtaywjrcxufvdwswaozxzeeduaeqslxuzcevplzosuqsedbplkmzbpyogbndbzmyfeyqamtetcjmaosbaxcrmjanjeglavxlwksvvenehzgrovffaebdtpynzajedywisavqgjjtjnqktzltyfzbvrtsfmdkzsyougzyqcckjcjjtkewysagddaizqnnptunmfyqagnxrzjqpsoqzqptzvjnfilpbgmjbetcgnewclwqxmftpepudwufcmbqtpyxajfmabqyvlgqxzhgumauzxms...
output:
-1
result:
ok 1 cases (1 test case)
Test #33:
score: 0
Accepted
time: 184ms
memory: 192740kb
input:
1 500000 2 bh nk zd bw cc la zr if ts tq nz td rv th nw az pa qy cq uu rk sl du ll jn fw qm rw va ii as hw wo vt zi yt wx xd en ws we rw gk lp hh qp fj cu uu bp uq ge lb sa hg yx gm cu tr wj ws ei cv ct wn at ju mo bm ht ep ul jt yw wu ml sh vt kp ha ws qy pn nz aq wa my mf bq ff xo br uc pt ne ya i...
output:
499408 499842 499559 499824 499915 499797 499667 499968 499320 499815 499795 499329 499539 499327 499864 499406 499685 499530 499653 499449 499005 499900 499822 499268 499906 499681 499834 499397 499396 499013 499475 499970 499649 499855 495348 499212 499776 499135 499198 499272 499171 499987 498431...
result:
ok 1 cases (1 test case)
Test #34:
score: 0
Accepted
time: 255ms
memory: 382348kb
input:
1 1000000 1 f l m t y i g k v k g z f h n e v m b g a n i u v a k b e j x n m u a x a g t g a g v p q f g q i f t l t t w z l z n m v r v v t x w q h x h k n t m i y k e j b m u q x n u t v f n h z w g v r m x c a g x p p n w y x j t b d z n h f u u i y p c w b m d k p p m q j k o g g b r w c y d h ...
output:
1000000 999987 999976 999956 999994 999972 999889 999936 999940 999920 999884 999924 999996 999952 999958 999997 999927 999935 999983 999880 999993 999954 999970 999991 999876 999986 999916 999975 999915 999995 999999 999918 999928 999984 999960 999998 999957 999873 999947 999833 999902 999767 99986...
result:
ok 1 cases (1 test case)
Test #35:
score: 0
Accepted
time: 192ms
memory: 25104kb
input:
1 2 500000 yoskytdthibiosryionvxhjbnvwyrumjrmogzlngtxwkyxpketeperfdqboobxcccofgoxsjjffgdymvbhrnmcfiresutjbeadpbwuyxbirokynuisiezakhyivnbelkoexbfertmmmpjyerxyrnxvseyyipjqexidomwdzwqgqopwvnguawlvdyqgpsoxuliobzndxyfondeygqyxujboqcmqmwlptkpxflccjwfbzvwjkmddqxuenqirajuqplwjfyumjycekqzgavjrpanuxixmwlmnnvv...
output:
1 2 2 1
result:
ok 1 cases (1 test case)
Test #36:
score: 0
Accepted
time: 253ms
memory: 28740kb
input:
1 1 1000000 vvzoohphaekmooymvzpvxqaxbgyabgrgrdetsieivthqtvackeaapshmaybrwivlzjtjymeqmjqjoioeknzlajdqeptnywzscjthxqahapfnktonvxbyridjhokyielyfuzzgciiulnuetgfmdppmpywhoouwbbwyhlufupqwkhjubvkplfbzxiegngnewwfpupzypskuhtopvqzczthyaxpepvbkhvitkxgopxprykcrbjnuiideigftkhgzpykkoijuiquebxaaiwaabuxssgqgsofmiid...
output:
1 1
result:
ok 1 cases (1 test case)
Test #37:
score: 0
Accepted
time: 124ms
memory: 23496kb
input:
1 1000 1000 nnnaamfktzgakyenqodpbujtlowzoloijjqorpyvgfbujjivqhgrvcsuajhkfnxfrtrrhfanoutnxetnhowuknugksqgbtpyixedmyepfgyluqjvgadnsosbevsprmupvmymsmohjpimcbgkrybnnlrgqewddkotengibpfdpfqbehofyslubivwusaxzjnbbuczjponsogapfzqnshokuerpwuewcedjmtykebmibjanhyfhvuieexfxijacmpkqatvctadngmkuefrfqthukhywwqllwwy...
output:
1 701 271 197 452 550 3 128 130 751 760 687 911 307 319 158 59 934 287 446 219 114 786 696 476 785 252 628 708 606 273 978 238 848 928 231 269 907 265 21 715 676 426 441 545 268 714 402 810 719 475 962 693 700 946 104 153 309 884 630 382 873 568 502 524 936 399 626 640 15 138 140 756 333 991 759 765...
result:
ok 1 cases (1 test case)
Test #38:
score: 0
Accepted
time: 149ms
memory: 193144kb
input:
1 500000 2 lm hm wf rl ze qc ku dz is dg lc kw ys ho re gu pb on oe wc ya kx zh fg lb fn ys ci da ta mg nc qj tx tn zw gu na ee oa qm zz hx rs fl bz ik fm sq xr tf id lh bk sw qx lw aa bx cg ns vl bg im qp pc rh pa ns kf la pl am sz xs xq uc wf lz iq ok mh wi kj ui xl na fs vg wf qg rn th ju rp fs w...
output:
499572 498112 499829 499765 499016 499687 499918 499591 498793 498563 499592 499246 499725 497848 499697 499835 499138 499965 499902 499803 498852 499447 499200 499977 499796 499861 497861 499672 499624 499932 499645 498359 499091 499066 499811 499916 499377 499646 499304 498464 499368 497565 499244...
result:
ok 1 cases (1 test case)
Test #39:
score: 0
Accepted
time: 272ms
memory: 381980kb
input:
1 1000000 1 h v a h z d c r l b t l d s z h c n p d v t x a z k i q g d p s i a z l e f q t v r b a f v v c z c w u s e d p w c n y f d f j i x b a h m w g b z h d m y q y u d s g l m t p u x w m h c t y p u e l h s x m f t p d f z z k w h s y i h v j w w s v h y a r f y d j w e a h k p x l x a k f ...
output:
999930 999924 999997 999920 999984 999979 999968 999919 999993 999991 1000000 999967 999933 999992 999983 999913 999951 999936 999985 999925 999922 999989 999982 999974 999958 999918 999959 999987 999975 999910 999972 999955 999952 999969 999948 999905 999921 999956 999939 999988 999851 999857 99996...
result:
ok 1 cases (1 test case)
Test #40:
score: 0
Accepted
time: 468ms
memory: 25196kb
input:
1 2 500000 csbazestpjffzjvrjztjidouhfewitwyhczwalacmlfmfpjozlnojeeltcyjkgbwpnzhzdeeublvjcgepkupvlqxhzkjfudcojhtxsrndyipgsuexhdjxodymiofmaxdkhsyallmorhqdrosgvzwvsgobotbwlwnqvohekjougktqmjaknocgtumjjvmtphfnoqrsrfgztpufvtnafmhmmcpxkrjyokgrlvaswhkkxfxguuakezavqkbkvnhjpycgvrsefranfttvrfnoaeempqhlsdzwtrvf...
output:
-1
result:
ok 1 cases (1 test case)
Test #41:
score: 0
Accepted
time: 223ms
memory: 29004kb
input:
1 1 1000000 zcgzehvspliuqlawrvemmxvlapmqsnpdieaqubpadgbsduckarfgikvmcphtdjtgczbfuivcjhpmwgaxoqvbmwldxvqwtcqizfyvxoahqcuyyvdgxzsohnkjblrwuyietchhqusxamzculyvhaqzoftboauhkdxnpxuxbljmftjtyrczfxxsbwkvzhehmwkhvbkjmnuypbjgibszsdtocihfzwuvdpvszccyroufgktzfytdkcrneuvelrcoufxvmxajvhlnikzfemppharjuwicizqodvrj...
output:
1 1
result:
ok 1 cases (1 test case)
Test #42:
score: 0
Accepted
time: 261ms
memory: 23568kb
input:
1 1000 1000 vkrkwbibcsuczrgypnuclsmvexjomqttgzmpebzbtmtltqyekywmlpmluwwmjjybbnztlxthcphhfayjjegghgyuippcrweyyzgjfnzemamafgtexvhxofarelxdoptwfohqrnjepcpxzkoepuluocahihxhqipydaiermnrbxjpkeundrirpdcalvbjyhhdazarjuwepzaiafcmbaxqlfqcnbzvlamfwgpqoutqvwhilaqswbqzvohiayenlifowexxzvuxrldswlfpjugwozxwzpxeqtkb...
output:
-1
result:
ok 1 cases (1 test case)
Test #43:
score: 0
Accepted
time: 201ms
memory: 192592kb
input:
1 500000 2 pa fn bi ka az wj sf db xb ad di ur he dq bv zf cw yw ha to hl al wi pq pq ao eh ua xo oi dw nz do dn oq sd bn nj fa mx vx ss pp dz jk us mv ko gk wa ju em bc tp qx cr rh ro qx vk bm ju ir kd ny gw sg js qt zi uf pg md du he qy ur ge dp ho hb ig zi dr wq ix my gz tf kb ab ye zf rx cy mq o...
output:
499937 499593 498355 498977 499979 499134 498580 499572 499523 497909 499783 499539 499668 499896 498511 498810 498943 499919 499474 499678 499810 499791 498998 499621 499129 499098 499829 499740 499968 498609 499972 498915 499330 499675 499015 498619 499643 499391 499599 498657 499660 499684 498564...
result:
ok 1 cases (1 test case)
Test #44:
score: 0
Accepted
time: 294ms
memory: 382412kb
input:
1 1000000 1 i b s i b r y g d n a s e b k h d f m c t a e u q d e s f p g t f u l v k z y s d d v m u e l c l v e q i o w f c k f f o y h b o r n h n j w d l z n p u n z t r w d e l g r u a v h t s k i y m q g a x z i p b w e m n i z g u g q c f c e h j e i t d r m g d h z w v y i l o u r m j l d p ...
output:
999972 999966 999979 999963 999948 999994 999982 999999 999973 999987 999997 999928 999974 999920 999990 999998 999949 999992 1000000 999967 999959 999969 999931 999939 999976 999945 999929 999859 999903 999954 999989 999943 999839 999879 999980 999964 999985 999988 999957 999854 999944 999930 99996...
result:
ok 1 cases (1 test case)
Test #45:
score: 0
Accepted
time: 225ms
memory: 61608kb
input:
1 100000 10 ehlimdmwkt jlrfzdjvam jwtsqoiebv mlksfsakmd zamugzmeha nxepoofxsh idoigdreky ugarhoilzd oalhajmyfd vfnxfsoasz fymboaopqw rgyhcdtcxm nvgtvzxgqs uhwapwajcq udicenzrkr jgeaupojpv efrdqjgayp yvqwqkaipk jlsbzxdzeh btdjgvxcqd uqcoyaaohl szcxibrkvc yzyntbtiuo lbwkorixzq lfffvwuktb euhjmdnptr tb...
output:
1 11595 6319 42583 65096 29926 4856 57986 48270 22767 48652 93545 43746 11820 42194 9336 42090 15338 11494 44649 48517 93994 12960 48798 87477 42449 9781 15528 55726 35164 85827 37124 73692 12681 54415 25832 81804 37672 8933 50813 8789 97691 97450 38100 49360 87715 56949 58457 38554 8106 4830 12515 ...
result:
ok 1 cases (1 test case)
Test #46:
score: 0
Accepted
time: 63ms
memory: 58480kb
input:
1 100000 10 mqpzaypqsg rybikrqyzx gxcfzgdglt sszegicsli oxzpnucwde ezkskhdmiu lqsgzsxckw jlglibuvpi ctqjnskviw yqhiaisjxf mpmgtaupwp swrhvwtxpg wcgchdtjyk hynexzwpxj veaomhaxnn bluwuxnmyj zeefjdwksv lgegdqxuyt ezkpautemn ykbpibnfsp ddbtafikzb cetuawmhwo epwldttkrv lytomstlzm wugxtmlmzf atathrowwp sv...
output:
1 47 77 60 17 71 13 3 31 26 6 16 116 19 34 9 5 36 93 69 14 2 28 4 21 102 22 38 23 45 46 64 29 82 105 113 61 85 67 40 32 147 97 42 43 86 15 197 10 66 75 11 44 7 134 172 91 50 68 20 18 25 183 30 58 117 149 74 121 70 170 49 193 76 199 184 88 57 24 201 131 229 78 62 119 33 37 90 206 96 59 98 169 8 112 1...
result:
ok 1 cases (1 test case)
Test #47:
score: 0
Accepted
time: 223ms
memory: 91136kb
input:
1 200000 5 untrg qewwk zdlct ltaki tegsd pllgg jvwkk pkcru donwe elvdq crquy yqlbl yalff rwhfy xlsqg vzjww vjdni vevwr njecm onvvj ldfjq ypgae vuuvu jxgce weone hnklb hkkyw tuwyp kgcad octvg gfkei ovmql kxzta npvrv pxenv hklvf sfzso blanl jigxz uqcrk lbehm cxwbq ymdzw hmvpk wjdqq kpfls rktrp ogdhs f...
output:
-1
result:
ok 1 cases (1 test case)
Test #48:
score: 0
Accepted
time: 55ms
memory: 58120kb
input:
1 100000 10 fxhzgdmpvu rbapkxuwdz rcbtjgzlqz vuwjdihqwk brwenfhpot cazbgafcaa ylyhnyrgwt sixsqzjakz qdxsdrthuu zdrwkcqqdk xluoyqriep wpcqewlpfo ebcmamyzmt fanzqaxbew ikmsqafyun xczrzagmdn bbsvmsrtph sjtudpeyqj kdvxgfnozj pnbefumkkh xjahjflidu begdvasklf xcragpudlh pkugzyrpgn dtlznmvred supuawndia xa...
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...
result:
ok 1 cases (1 test case)
Test #49:
score: 0
Accepted
time: 208ms
memory: 90924kb
input:
1 200000 5 rdaxv rqwti srbck qdtal ltoxk ughkh sywke cigmu fioqb gnycn cexck tcekr byyqn cgokp ausjo ubsgq sxouf xxvnu drjqw nvaul ashzf scexc ueyta ryyny xotaf prjgo hjfrk alqrp zggry xrivg wislr lzygn lleum utbzq dzbpn kmkvp bacqh kdfik xaqru aeeem otmht exrjh poyfh rgggk mhbof kqyzm czill oygax c...
output:
-1
result:
ok 1 cases (1 test case)
Test #50:
score: 0
Accepted
time: 467ms
memory: 25220kb
input:
1 2 500000 tossrwlzkdzzrphwvvnkmdevslssgacszrojwkxgorcupejhwfybmoyegfhulclkqadmdjpfccnbxhsumeffzhfowyhxqqpdrjguansbqlyuglodfwxjphusmwlevcmpjfcbrjbmdbsqovuljaxqfeorcmgjsbwxappqwsuacmjtyhjubdjyevglxpkektgumdrvtwkuzdiyznzactijqouerxfqatzcwjqserfliiqihufyinagdbqglcnqttlhkebmezdjcfvdcmcjgqhygbxmvzndqnywm...
output:
-1
result:
ok 1 cases (1 test case)
Test #51:
score: 0
Accepted
time: 579ms
memory: 28756kb
input:
1 1 1000000 aqfomtfebdjjikpwsgohpqhvbrasmasgmocifvxczotxorlguxtriaftafotynozikgxytfzuztzapeayssibygltogshsbfwlfcqzbfkleizodgzztxzaysqtsvokwictzyehplvlkpucyizyrcimlczpucivarsihznzqmkjyuhajkgasakdeechddnrezbboozngkyxrjkzfgdlzjewmzhfwmfzguwukeeaambyszysderzrbbbdraxbdpqrurmztoepgptyjtbnrwpyntoagemsfeari...
output:
-1
result:
ok 1 cases (1 test case)
Test #52:
score: 0
Accepted
time: 181ms
memory: 61728kb
input:
1 100000 10 kxlhbmfknl mldtlbegjo roglqswqdz fkcfeioyrf varxnuxhyk yputtwlqnj qjfqxkpbug thnarwcjpt oqfpxygtat hagzhuqeem bwnnbeweqg semgcubiaz zoomamfsyb lhocxkgyvp nzqeqkhpes hhhqaraqjq mdcgqoqgbp gvsxjqnvjv sfkoamvaor sngtozdbrc yrhpdcfhhf eptkmcorhi hwszrfyvqr xemzcudvkz rjklevonsv vnpmsgqdcb sy...
output:
1 12060 73319 90546 77415 58240 68042 15249 43375 15637 44942 46003 9071 37726 71832 82259 69706 11228 50338 15551 35480 66090 21036 15397 98241 97388 30260 32643 26082 67395 44301 83285 91565 29557 62876 90767 78864 27482 79984 99852 99667 43062 23958 77405 73878 14881 36645 20160 8858 16712 42866 ...
result:
ok 1 cases (1 test case)
Test #53:
score: 0
Accepted
time: 246ms
memory: 62004kb
input:
1 100000 10 dplijbwkgs yigahsojnn ftafmnroiu gklxajdgis lkkiioljfz mkckxjukta rwxjqmbddd opvmalbpzl ngobvwffjt ziszyyrvkb hxjvrmnlnm pcytdvmvcb jyzqhxxzpd ykfcpnynxt tqfqojtyoc cyphatoadm nsibkreiqr sjujphkbwv wdccnduvvj gefgntmint qodiytabxc vpeltdzowm fppmxjflkq vhohdpiocs vuudozaxuh uoonxsqeko iq...
output:
-1
result:
ok 1 cases (1 test case)
Test #54:
score: 0
Accepted
time: 195ms
memory: 62216kb
input:
1 100000 10 qyjclrjhcv hrexdepsrh drbmgtcoed twbslhlapq tocwgicnrn ndudcbqcoz eunlkqeugj ictesjwnlv ukatawfiji dktfpbehwi yggzqhuccl oznogatwir efcduoftki ojyrolvatq fkpbtdwpmj lliymvqkws taqnrqowtg uzfiimgmkz lmavtcmajn hagghgkdro eprquadsxn ztmzpejqea vzitenazyw nhcbbtdnuu frafncvjoy javzrcwaus ap...
output:
1 35767 42520 53681 86955 36276 95548 92482 43111 94100 1423 71104 39124 45900 26672 48564 41529 8278 32325 68034 75064 37289 77034 31597 2317 89594 71848 79869 60742 84608 89735 95231 76722 13364 95582 23643 83865 98812 46790 30019 27654 732 28747 24376 96627 87416 59556 36588 79266 32206 55706 103...
result:
ok 1 cases (1 test case)
Test #55:
score: 0
Accepted
time: 260ms
memory: 62236kb
input:
1 100000 10 sypalllczm fyvwvgicyp jqomdiqcfp aeaaztogli imxeiuthuk ydkrfpfmft udmkztmwfe ohyczkizug fzjyyniywg itrowixklc tussdfceqf evpuvluxpg iluimcnpco olstppvixo dvdpowweue hxiodpcvjl xhflfalebb vpfsjldkqf dfjslcblpv dzfptmeyqv rvgrnefzaj illzbltjxb xbbdvyufbw frovlztkno gsylowileo zasbhsaiku rw...
output:
-1
result:
ok 1 cases (1 test case)
Test #56:
score: 0
Accepted
time: 164ms
memory: 60916kb
input:
1 100000 10 jghpqhzbwn khmnmmjces evcbszdsee cpedxvljuc bijisgizio lwybtheziw azeowrjbes bvcakdyowl hqrgrmdxkv latrynwkve zbwrfmlfzl bwsrqcxufw mlxgssthvv tbnlrnnagy fumhlmrrsc klisexvqbh fuhiznqnbs gydnvmatzs kddgnpybzt lqtposlfrf teyereqlki phffqzyxsk zivoiupzye fhyewkrofw vmhqdpsznj kkfzikuoop fd...
output:
1 50473 61393 8558 92736 91642 77107 13290 83773 69873 4812 45147 77721 86707 36682 98061 42939 64592 11284 16018 10373 84283 10097 40126 77316 33733 91810 74755 14270 2438 33383 91856 84540 78631 84435 19853 67669 69710 5311 31653 5143 31261 19152 26311 46496 11542 32301 96779 96868 68321 11004 392...
result:
ok 1 cases (1 test case)
Test #57:
score: 0
Accepted
time: 190ms
memory: 62760kb
input:
1 100000 10 ajdomreiyg awhziinfwu gtqxnxstjq acgalthnvc rlnbmtemxi ouqfgtxjel zrpqnultuj ajpfxgstzw ugccienqit cgyjlqfkma fvvzhsruhh xzvtqxdzfx bzklilivkt vracwjjijn pijsxthpiv sloandhcmh uezrrpwwrp qizguxpvwx fgfwudmpmw zmddapzqly fvxavrqcax pstjlrahls zaewasovpv wxbnphincw bcauhtuzyg svvtswoswv sy...
output:
1 13480 79901 96121 48886 83346 72931 39021 29550 44527 65050 89685 55031 86010 96314 31257 52431 52046 29446 61421 91394 32525 73198 12259 87278 46434 12142 20877 82267 47747 43826 23628 74492 13152 90514 79249 2289 36294 37875 71057 3461 65438 71479 97444 3522 29698 20072 57665 86343 24988 71537 6...
result:
ok 1 cases (1 test case)
Test #58:
score: 0
Accepted
time: 252ms
memory: 61604kb
input:
1 100000 10 otqeflvutp ktjpzyjlbe utqhsjbhxi jmmcfrwiml vfxvqrdzdk aenkvqbzpo bfdzgohawd vdsqzihcsw jicioserdw eberxkmhko vsmxkcsymw aunqxqooio fuserissyp powkmizyqg pklrsxredz kvwierqibi wrzusyeiou odjaxqedqv xxntmrkafl wkgkolzgdv jxwmcpjiya pxyhhfzjsh ewcjkdaymm taklqmzazs mwvlhirbzn lfzultiztz sn...
output:
1 21762 56756 31614 83874 3377 81430 27510 12997 69279 19706 92899 32051 16108 12615 1879 72447 9813 56417 20390 75673 70618 26126 7360 35906 318 78492 4181 46675 17287 49218 80725 12080 32866 75456 6053 98140 21185 41724 3778 39440 68765 59667 88079 81576 6167 65843 88076 6568 30403 56603 90622 188...
result:
ok 1 cases (1 test case)
Test #59:
score: 0
Accepted
time: 253ms
memory: 61408kb
input:
1 100000 10 uxfboqjiml urguovogte hlfrgfwgkz lnaljmgocb cbkdynsxzg jfggokuktr fgeeeayprq glgeqdexax ccwqbwaake pexvcckyid rjvzlorehp jwrolcaeqq pwftjauyxv dtblxopysv pmvikikgse pldtousdqo tgenvzvdnr payixpmmjr urkthfeotj pqomqonmqf wsnfwcbqce ynjhtrkmcg nqjuozngbr ombhjkloow fxbwspocpf ovcbrjolwn yn...
output:
-1
result:
ok 1 cases (1 test case)
Test #60:
score: 0
Accepted
time: 270ms
memory: 59360kb
input:
1 100000 10 ipzgqbnfvd sgfrlagntk gwwweijzea fxpgdtxgti waobttsufl nrdslhdkxf ssrwruilxq pdglmfvowa azjbrlhzff pchtakzdkl ajsqpedcoy pjsukcypln fiognbhmxj agpmnzvnms ikdnsabypt zaotlspbvj nummgjsshd mtteglneuy eopvrvdxtb nuwnziuqyv pmqxpafghb krwuxxunvh dnumirddbi oyiyooimqd zmlwgndkny ybxqktsjpq kv...
output:
-1
result:
ok 1 cases (1 test case)
Test #61:
score: 0
Accepted
time: 264ms
memory: 62352kb
input:
1 100000 10 vhntzmzfjq lpkanhwnma hnshcjeytm rroumhwnmt jeweevjgqp bsegdybxio rwtjvtvlko fmpcrdsdes edijyqpurg zghldxztvl xbcsrduzmx tguxmkqcfz bajotxtuii zsfgpkokbg xrgnvbpctc clxyepehzt veudydfurf mavbkeurwo nfmwtnwspx uahthuvvxc vdaadmfinf kyhxwovgtv jnqppwnuvt hiepfckmpa oxrklvvyof iintishepc eq...
output:
1 36720 23860 4571 26746 10499 88779 27419 76488 63036 62350 82534 60879 45968 98970 32266 63191 8359 99114 76508 74083 19554 35470 52277 73138 87243 50701 60515 94009 4090 9557 31696 95235 16202 16689 81749 97371 50185 82806 75366 89893 44503 60695 2749 99688 99710 42507 30081 50350 51732 56413 292...
result:
ok 1 cases (1 test case)
Test #62:
score: 0
Accepted
time: 204ms
memory: 62268kb
input:
1 100000 10 uudwzdlejj ivabpznlij uqnmtxmmgg ntzanognix qdgoodcnun pekrqklkez eejprmjekr pwblriymwp rievkuhrez npbdnosxjq eoeicddyic hotgqnlmge iygqxwlogm pnsgildmtr rqkpassked qpsqosjzsm phxkunmotd oohtwpcpli ejeiosheqn rzrjlvpkfa ynajbomlnb awxowbwzxx hfajxtyefh ulxeladiwo mroseowqdn fszffsdlmi lm...
output:
1 88278 14640 76004 39925 63722 51489 16331 76561 93346 33349 93045 14558 74714 74087 88553 28906 45757 86791 18812 49052 90615 25830 17423 92785 3360 92013 98090 81900 84402 39854 67910 99497 12068 66630 51570 53928 99211 5455 65956 60347 72971 81159 38877 81360 34141 94422 63027 69144 20513 90945 ...
result:
ok 1 cases (1 test case)
Test #63:
score: 0
Accepted
time: 268ms
memory: 61444kb
input:
1 100000 10 akvvptzhlm ukqiqwgjxr raftyctsec tljopwxqgm odkoyjszvv vuuxpzuwty vugkbhgrbq mghdhtbdmh cmlrrcpkrj fropiipnog fippflholr hxvyifxfhi dstwpsdbxl zekzumxmnr qywqzyxvln jacdvjvczu dpmjugphun hhrhfdjzkx jfwnfjfokw ygziaihrgd ybrhjiwfaj nketysvhiu sydarvrsdv zlhwpjkvmc ynaolmsimg tgjfocrgba kh...
output:
-1
result:
ok 1 cases (1 test case)
Extra Test:
score: 0
Extra Test Passed