QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#718479 | #7743. Grand Finale | maspy | AC ✓ | 492ms | 101728kb | C++23 | 15.8kb | 2024-11-06 20:37:19 | 2024-11-06 20:37:19 |
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"
/*
枚数は広義単調増加
はじめて捨てるのはどれか
とりあえず2乗状態数にはなりそう
手前と後ろから?
手前
dp1[n][count1] = count 2 or inf // 捨ててないなら一意
後ろ
dp2[n][count1] = min of count1, 最後まで行けるような
*/
int dp1[2501][5001];
int dp2[2501][5001];
void solve() {
LL(N, M);
auto get = [&]() -> vc<int> {
STR(S);
vc<int> A;
for (auto& x: S) {
if (x == 'G' || x == 'W') A.eb(0);
if (x == 'Q') A.eb(1);
if (x == 'B') A.eb(2);
}
return A;
};
vc<int> A = get(), B = get();
FOR(i, M + 1) {
FOR(j, N + M + 1) { dp1[i][j] = dp2[i][j] = infty<int>; }
}
vc<int> init(3);
for (auto& x: A) init[x] += 1;
vv(int, S, 3, M);
FOR(i, M) S[B[i]][i] = 1;
FOR(x, 3) S[x] = cumsum<int>(S[x]);
// dp1
dp1[0][init[1]] = init[2];
FOR(m, M) {
FOR(n1, N + M + 1) {
int n2 = dp1[m][n1];
if (n2 == infty<int>) continue;
SHOW(m, n1, n2);
if (n1 > 0) {
int mm = m + 1;
int nn1 = n1 - 1 + S[1][mm] - S[1][m];
int nn2 = n2 + S[2][mm] - S[2][m];
dp1[mm][nn1] = nn2;
}
if (n2 > 0) {
int mm = min(m + 2, M);
int nn1 = n1 + S[1][mm] - S[1][m];
int nn2 = n2 - 1 + S[2][mm] - S[2][m];
dp1[mm][nn1] = nn2;
}
}
}
// dp2
FOR(n1, N + M + 1) dp2[M][n1] = 0;
FOR_R(m, M) {
FOR(n1, N + M + 1) {
// どっちを使うにしてももらうのは最初の 1 枚
if (n1 > 0) {
int mm = m + 1;
int nn1 = n1 - 1 + S[1][m + 1] - S[1][m];
int n2 = dp2[mm][nn1] - (S[2][m + 1] - S[2][m]);
chmax(n2, 0);
if (n2 < infty<int> / 2) chmin(dp2[m][n1], n2);
}
// 2 を使う場合
{
int mm = min(m + 2, M);
int nn1 = n1 + S[1][m + 1] - S[1][m];
int n2 = dp2[mm][nn1] - (S[2][m + 1] - S[2][m]) + 1;
chmax(n2, 1);
if (n2 < infty<int> / 2) chmin(dp2[m][n1], n2);
}
if (dp2[m][n1] < infty<int>) SHOW(m, n1, dp2[m][n1]);
}
}
int ANS = infty<int>;
FOR(m, M + 1) {
FOR(n1, N + M + 1) {
int n2 = dp1[m][n1];
if (n2 == infty<int>) continue;
if (dp1[m][n1] < dp2[m][n1]) continue;
int now = n1 + n2;
now += init[0];
now += S[0][m];
SHOW(m, n1, n2, now);
chmin(ANS, now);
}
}
if (ANS > N + M) return print("IMPOSSIBLE");
print(ANS);
}
signed main() {
INT(T);
FOR(T) solve();
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 6012kb
input:
2 2 6 BG BQWBWW 4 6 GQBW WWWWQB
output:
3 IMPOSSIBLE
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 6020kb
input:
2 3 8 QBG BBBWBWWW 3 8 QBG BBBWBWWW
output:
3 3
result:
ok 2 lines
Test #3:
score: 0
Accepted
time: 128ms
memory: 99528kb
input:
13 184 887 WBQBBWWBQBQBQBWWBBQQWWQQQBBBQWWWQWBBBBWWWQQBQQQWQBBQQWQQBBWWQWQQBWBQWWWWQWQQWQBWWQQWWQQBWWQWBBBWWQWBQBQWQQWWBQBQQBWQBQBWWBWQWQWBWBQWWQBQQQBWQQWQWWBQBWWQQBQWBQQBQQBQBBQBWBQQWWQBWBBQQBQG QWBQBQBWBQQWWWWQBBBQQQBBBWWWWQWQWWQQQBQBWQQQBWQWQBWWBQQQWQWBQBBQBWBBWBQWQBWWQQBWQQWWQWWQQWBQQWQWBBQBWBQQ...
output:
184 372 316 161 118 534 IMPOSSIBLE 631 183 276 33 160 643
result:
ok 13 lines
Test #4:
score: 0
Accepted
time: 82ms
memory: 100700kb
input:
32 887 278 BQBBWWBQBQBQBWWBBQQWWQQQBBBQWWWQWBBBBWWWQQBQQQWQBBQQWQQBBWWQWQQBWBQWWWWQWQQWQBWWQQWWQQBWWQWBBBWWQWBQBQWQQWWBQBQQBWQBQBWWBWQWQWBWBQWWQBQQQBWQQWQWWBQBWWQQBQWBQQBQQBQBBQBWBQQWWQBWBBQQBQQWBQBQBWBQQWWWWQBBBQQQBBBWWWWQWQWWQQQBQBWQQQBWQWQBWWBQQQWQWBQBBQBWBBWBQWQBWWQQBWQQWWQWWQQWBQQWQWBBQBWBQQBWW...
output:
887 981 15 18 60 9 108 268 475 17 52 12 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 76 14 182 907 537 19 19 233 10 38 111 143 103 159 14 IMPOSSIBLE 225
result:
ok 32 lines
Test #5:
score: 0
Accepted
time: 27ms
memory: 59292kb
input:
120 37 178 BQBBWWBQBQBQBWWBBQQWWQQQBBBQWWWQWBBBG BWWWQQBQQQWQBBQQWQQBBWWQWQQBWBQWWWWQWQQWQBWWQQWWQQBWWQWBBBWWQWBQBQWQQWWBQBQQBWQBQBWWBWQWQWBWBQWWQBQQQBWQQWQWWBQBWWQQBQWBQQBQQBQBBQBWBQQWWQBWBBQQBQQWBQBQBWBQQWWWWQBBBQQQBBBWWWWQWQ 21 184 QQBQBWQQQBWQWQBWWBQQG QWQWBQBBQBWBBWBQWQBWWQQBWQQWWQWWQQWBQQWQWBB...
output:
37 24 41 23 46 22 21 24 31 178 23 26 50 IMPOSSIBLE 23 24 25 24 IMPOSSIBLE 43 17 37 35 46 44 42 25 44 33 33 8 14 21 IMPOSSIBLE 36 32 50 79 IMPOSSIBLE 42 34 42 12 IMPOSSIBLE 32 35 44 13 50 IMPOSSIBLE 47 IMPOSSIBLE 37 16 42 38 IMPOSSIBLE 34 37 30 45 IMPOSSIBLE 46 42 42 34 30 32 27 IMPOSSIBLE 25 14 39 3...
result:
ok 120 lines
Test #6:
score: 0
Accepted
time: 5ms
memory: 9776kb
input:
543 4 37 WBQG BBWWBQBQBQBWWBBQQWWQQQBBBQWWWQWBBBBWW 2 20 QG BQQQWQBBQQWQQBBWWQWQ 6 47 WBQWWG WWQWQQWQBWWQQWWQQBWWQWBBBWWQWBQBQWQQWWBQBQQBWQB 20 41 WWBWQWQWBWBQWWQBQQQG BWQQWQWWBQBWWQQBQWBQQBQQBQBBQBWBQQWWQBWBB 12 38 BQQWBQBQBWBG QQWWWWQBBBQQQBBBWWWWQWQWWQQQBQBWQQQBWQ 3 15 BWG WBQQQWQWBQBBQBW 2 12 WG...
output:
9 4 IMPOSSIBLE 20 12 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 8 IMPOSSIBLE 6 IMPOSSIBLE 18 IMPOSSIBLE 18 10 19 19 14 6 IMPOSSIBLE IMPOSSIBLE 7 8 12 IMPOSSIBLE 6 15 13 15 14 13 IMPOSSIBLE 20 5 18 9 11 13 12 10 8 14 9 6 12 14 8 8 IMPOSSIBLE IMPOSSIBLE 19 16 9 15 12 20 10 IMPOSSIBLE 5 12 IMPOSSIBLE 16 9 IMPOSS...
result:
ok 543 lines
Test #7:
score: 0
Accepted
time: 4ms
memory: 6100kb
input:
558 11 32 WBBBQWQWQBG WBWQBWBQQBBBWBWQBBBWWQWBBQBBQBWW 17 23 WQWQBQBWWBQBBBQWG BWQBBWQWBQQQWWWWWQWBBWB 10 22 BBWWQQQWBG BQWBWQBQQBWWQWQWQBWQQQ 16 22 BBQWBQQWQQQWWWWG QQQWBQWQWWQQWWWQBQQQBQ 14 32 BQQQWWWWQQBBQG QBQQBQWBWWWWWWQWWQBQQQWQQWQQBWQQ 1 16 G BBQQWWBBBBQBBQWW 16 49 QQQQWQQQQQBWQBBG BWBWQWBWWW...
output:
11 17 10 16 14 IMPOSSIBLE 16 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 16 4 16 16 7 IMPOSSIBLE 15 15 16 10 17 16 9 11 16 IMPOSSIBLE 8 20 7 IMPOSSIBLE 15 10 11 16 18 7 15 19 9 7 8 IMPOSSIBLE IMPOSSIBLE 14 18 4 IMPOSSIBLE IMPOSSIBLE 10 11 16 10 13 16 6 16 IMPOSSIBLE 19 IMPOSSIBLE 17 IMPOSSIBLE 20 8 10 15 10 17...
result:
ok 558 lines
Test #8:
score: 0
Accepted
time: 4ms
memory: 9888kb
input:
566 9 16 BBWWQWWQG QBBWQWBBQWBWQWWW 3 7 BWG BWBQQQB 10 15 BQWWBBWBWG QBBWBWBQBQQQQBW 8 17 QBQQBBQG QQWBBBQWWWBQWWQQQ 18 46 WBQBQQQWQQQQBQQWWG QQBQWWQBBWBQQBQWWWWWBBWWBWQBQWQQQWWWQWQWWWQQQB 20 38 WQBQWQQBQQWWQWQWQWBG BBBBBBQQBBQQQBBBWBBQWBWBBWBBQBQBWBBQWW 20 17 QBQQBWBBBBWWQWBBQWWG QWWBWQQQWWBWQWQQB ...
output:
9 3 10 8 18 20 20 IMPOSSIBLE 19 IMPOSSIBLE 10 15 IMPOSSIBLE 12 7 IMPOSSIBLE 8 13 15 6 12 11 13 5 7 20 11 12 16 IMPOSSIBLE IMPOSSIBLE 11 4 14 IMPOSSIBLE 20 12 10 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 9 15 14 11 19 17 5 12 20 15 14 16 20 17 9 10 17 7 11 13 18 15 7 IMPOSSIBLE IMPOSSIBLE 4 18 IMPOSSIBLE 12 6...
result:
ok 566 lines
Test #9:
score: 0
Accepted
time: 4ms
memory: 7908kb
input:
549 16 26 WQWWBBQWWWWQQBQG WWWWBWWBWBWBQWBWBBWQBQQQWW 1 16 G QQWQQWWWBBQQWWWQ 19 36 QBQWWWBWBQWQWQBWQBG BWQQBQWQWWBQBBWBBQQWQWWWWWWQBWWWBQWQ 8 17 BWBWWBBG QWWBQBWBBBQQQBWWB 6 21 QQBQWG WQQWBWQWWQBBWQWQQQQQB 2 46 WG QBWQQWQWWWWBWQQQBBWWBBWWWQQQBQBBWBBWQBWBBBWQBW 6 27 BQWWWG BWBBWBWQWQWBWWQBBBWQBWWQQB...
output:
16 IMPOSSIBLE 19 8 6 IMPOSSIBLE 14 13 20 7 9 IMPOSSIBLE 11 17 16 18 19 19 19 9 12 16 18 IMPOSSIBLE 11 12 IMPOSSIBLE 11 13 19 13 IMPOSSIBLE 20 IMPOSSIBLE 11 17 10 11 IMPOSSIBLE 17 5 IMPOSSIBLE 13 20 19 18 13 13 IMPOSSIBLE 13 9 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 8 16 10 15 20 17 13 18 10 20 8...
result:
ok 549 lines
Test #10:
score: 0
Accepted
time: 7ms
memory: 10236kb
input:
370 2 37 WG BWBBWQQWWBQQQWBQBWBWWBWBQQBBWQQQQWBWQ 9 1 WQBWBBBBG B 7 18 BWQBQQG QBBWBBWBQBBQQQWQWB 2 41 WG QBQBQWWBQWBBQBWBQBWBQWBQBBQQQQWWBWQBBQBWW 5 52 WQWQG BWWQQBQQWBWBBQQBQQWWBBBBQQQWBBQQBQWWBWWWBWBQWWQWWWBB 9 71 WBWBBBQWG QWBWBWBQWQWBQQQQQWBBBWWWQWQBWBWWQBBBBQQQQQBBQBQWBWQBWQQWBBQQWQQWWWBQQWQ 9...
output:
IMPOSSIBLE 9 7 IMPOSSIBLE IMPOSSIBLE 15 9 10 3 10 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 10 IMPOSSIBLE 7 IMPOSSIBLE 6 16 IMPOSSIBLE 15 4 6 12 10 13 11 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 17 IMPOSSIBLE 10 8 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 7 IMPOSSIBLE IMPOSSIBLE 21 9 13 10 6 IMPOSSIBLE ...
result:
ok 370 lines
Test #11:
score: 0
Accepted
time: 174ms
memory: 101200kb
input:
5 1000 2500 QBBWQQWQQWQQWBQQBQWWBWBQWWBBQWBBWWQWQWQQWQQQBQQWQWBBBQBQQQWBBQWBWWBWQQWWQWQWWQBBWQQQBWBBBQWQQBBWBWWBWBQQWQWWQQBQQBBBQWWWWWWQQQQQBWWBWWQWWQWQQWWBQQWQWBBWQQWQQWBBWQQWWQBWQWWQWWWWBBQBWWBWWBQWQBBBWBQWQBBBBWWQBQQQWQWBBQQQQBQBQBWQWWBQBWQWWQQQBQBWQWQWQBQBQQBQBBQQQWQBBBBQQBBWBBBBBWQWBWWBQBWBWBBB...
output:
1000 1000 1000 1000 1000
result:
ok 5 lines
Test #12:
score: 0
Accepted
time: 197ms
memory: 101728kb
input:
4 2500 2500 WBQQQWBBQBQQBQQBWQWBQQWBQBBBBWBBBBBWQWBWQWQBBWQQWBBWWBQWWBQQBWQQQWWQQQQBBQWWQBQWQWBWWBWBQQWQWWBWBWWBWQQBQWBQBBWBWQBWWQQQQQBWBBWQQWBQWBBQBWQBWWQWQQBQQWWQWQQBWWBQBQWQWBQQQQWQWWWWWBQWBWWWWQBWWWBBQBBWWWWWWBWBBBBWWBWQQWQQWBWBQQWBBBQQBQWWBBBBQWBWQQBBWWBBQWQBQQBQWBBQQBQWWBBBQWBQQQWWBWBWWWWWWQWW...
output:
2500 2500 2500 2500
result:
ok 4 lines
Test #13:
score: 0
Accepted
time: 196ms
memory: 101240kb
input:
7 192 2500 QBBBBQBQWWQQQBQQWWBQBQWWQBBWWBQWBWQQWBQWQWQQBQBWWQQQQQWQBQBQWWWQQQQQBQBBQBWQBWQBWBBBBQWQBBBQWBQQBQQBBWQQWBQQBBWBWQQQQBQWQWBQWWQQQQWBWBWBQQWBBQQQBWBBBWQBQWQWWQWWBQWWWBBQBWWWQWBWBQQWBQQBWQBQBBQG BWWBBQWBBWBBQWQBBWWQQWQWBBQWWWWBQBWWWQWBQBWWQBBQBQQWBBBQWWWWBWWBBWQQQQWWBBWQQQBBQBQWWWWWBWBQBBBW...
output:
516 378 482 460 358 486 483
result:
ok 7 lines
Test #14:
score: 0
Accepted
time: 180ms
memory: 101148kb
input:
7 325 2500 WQBQWQQBQWWBBWWBBBWWBQBQWQQQBWWQQBQWBBQWQQQBWBWQQBWWWWBQQWBWBQQBBWQWBQBBQBWWQBWQQWQQWBBWQWBBWBWQBWWBQBQQWQWWWWQWWQWQBQQBWBWBWBWQBWWBQWBWWBBBBBBWWQQQQQBQBQWBBBWQQQBWQWWQBBBBQBBWWBBWWWWBWBWBWQBBBWBBWBBQWBWWQQBWWWBQBQWBBQBQBQWQQBBWWQWBWBBWQQBQBWQQWWBBWQBBWQBQBQBBQQQBWBBWQWBWWWWBBBBBQQQQWWQBW...
output:
325 520 438 335 339 414 286
result:
ok 7 lines
Test #15:
score: 0
Accepted
time: 173ms
memory: 101228kb
input:
7 159 2500 BBWWBBWQBQQWWBBWWQWWBWQBQQWQBWBWBBWWQBQBBQBQWQWWWWBQWBWWBWQWBWBWQQWQWWBQQQQWWQBWWBQBQWBBBWBWBWBWQQWBWQBWBWBQWBWBQWQBBBWQBBWWQQBQQQWWBBWWQWWQBBWWQWQWBQWWBWWBWQG WWQBWBWBQQBWQQBWWWWQBQQBQBQWQWBWWWBBQBWQBQWWQBWWWBWBWWWWBWWBWBBWWWQWBQQWQQBQBBWQWBQWBWWWWBBWBQBBQBBBWBQWWWWQQBQQQBQQBWQQWQWBBQWQW...
output:
570 576 307 351 291 418 375
result:
ok 7 lines
Test #16:
score: 0
Accepted
time: 179ms
memory: 100616kb
input:
7 384 2500 WBWBWBWWWWBWBBBWBQBBBQBWBQQBQBQWWQQQBBQQBWQWBBWBWQQQBBWQBQWBBBQQWBQWQBQBBQBWBWBBQBBBWBBQQQBWBWWBQQQQWQBQQWWWWQQBBBQQQWBBWWWBWBBWBWQQWBWWQWBWWBBBQBWQWQQWQQWWBQBWWBWBBWQBBBBBQBBQQQBQWBBWWBBWBWWBQBWWQWBWBWWBQQBBQQQQBWWQQQQWQBQBQWQQWBWQBBBWBQWBQQWWWBBWWBBWQWWWWWWBBBBBBQQQBQWQQQQWBBWWWBBWQBBWB...
output:
384 451 IMPOSSIBLE 376 799 681 455
result:
ok 7 lines
Test #17:
score: 0
Accepted
time: 268ms
memory: 96144kb
input:
34 410 1517 BBQWQWQBWQQBBQQBQQQWQWQWBBBQWBQBBQWWBBBQBQBWBBQBWWBWBQQBQBBQBWWWWQBBWWWWBBWBBBWBQQWQWQQWWQBBWWBBWBWQQQQQWQBQQBBQWQQQBBBQQQWWWWWWWBQQQBWWBWWBBQQQBWQQBQQWWBBWQBQQQQQWBWWWBQBBQWWWWQBWQWBWBQWGQQWWBBWWWWQBBQBBBBBQBQWQQBBBWQWBBWWWBWQWBBBWQBQWQBBWQQWWWBQBWQWQBQBQWQQWWWWBBBQWWWQQQBWWWBQWQWQQBQWW...
output:
410 370 305 308 416 61 236 458 183 463 483 316 IMPOSSIBLE 255 475 305 486 153 193 249 IMPOSSIBLE 264 155 394 364 336 153 343 394 471 415 319 421 280
result:
ok 34 lines
Test #18:
score: 0
Accepted
time: 6ms
memory: 8000kb
input:
1627 19 34 BQWWWWBQWQWBBGQWWQB QBBQQQWWBBBQBWBQWBBBBWBWQBQWBWBQQQ 20 1 WBBQBBBWWBGWBQWQQBQQ W 2 38 GW BQQBQBQBBWQQWQBBBBBQBQBQQBQQBBWBQQBBBW 15 15 QWBQWQQWWWWQWWG WWBQBBBBQWWWBWB 15 2 QWQBWWQGBWQBWWW WB 11 24 WBQWWBQWGBQ BWQWBQBWQWBQWQWWWBQQWQWW 8 37 QGWWQBWQ WBQBWBBBBBQQQWWQBWWWBQWWWQQBBWWBQWWWB 11...
output:
19 20 IMPOSSIBLE 15 15 11 12 11 3 11 IMPOSSIBLE 13 6 17 13 9 11 10 5 12 14 14 15 11 14 19 17 18 14 10 IMPOSSIBLE 14 14 5 10 12 7 10 IMPOSSIBLE 7 6 IMPOSSIBLE 8 9 17 10 IMPOSSIBLE 4 17 18 14 IMPOSSIBLE 20 8 13 11 11 11 17 8 14 12 5 14 13 19 IMPOSSIBLE 15 6 4 4 16 10 17 11 17 IMPOSSIBLE 13 15 IMPOSSIB...
result:
ok 1627 lines
Test #19:
score: 0
Accepted
time: 15ms
memory: 9912kb
input:
661 14 69 BBWBWWGWBWQBBB BWWBBQBBWQBBBBQBBWQQBBQQQBWWWQQBQWBBQWWBWWBWQBWBBBWWBQQBBWBQQBWQWQQQB 18 67 QQGWWBBWWBBWBBQWQW WWQQWBWBQBBWQQQBWBBWWWQQWQWWWBWQWWWWBQBBBWWBBQBQQQQBWWWQBBQQBBBBQWB 34 7 QQQQWQQWQWWWWQWBBBQBBQWQGWBBQWBQBQ BQWQQWQ 17 85 BWBGQWBBBBBBBQQWW BBQQQQBBWWBWWBBWQQWQBBWWWQWQWBQQBQWQBWWQ...
output:
14 18 34 17 49 18 49 50 11 40 10 25 21 48 25 34 24 29 IMPOSSIBLE 9 46 44 37 21 30 44 14 19 IMPOSSIBLE 32 20 IMPOSSIBLE 33 21 42 28 16 16 47 50 35 IMPOSSIBLE IMPOSSIBLE 50 15 37 36 IMPOSSIBLE 24 25 19 43 39 18 13 IMPOSSIBLE 28 35 10 36 36 47 45 41 39 IMPOSSIBLE 49 9 20 21 24 24 35 13 18 8 47 48 49 31...
result:
ok 661 lines
Test #20:
score: 0
Accepted
time: 57ms
memory: 24816kb
input:
168 67 58 WBQBBWWQWWWWQQWQWWQQBBWQQBBGWQWWWBWQBQBWQQBQQQWBBBBQBBWWWQWQWBQWQBW BQWQBQQWWBBQWWBWBBWQWWQQWBBQQQBBWQWWBBQQQWQBQQQBWWBBBQWBQW 73 247 QBQBQQGBQBWQBWBBBQWWWBWWQWBQBBWWWBWBQBBWQQQQWQQQWWWBQQBWWQWBBBQQBWWBWWBQQ WWQQQWQBWWQQWWWQWWQBBWWWBBBBWWWBBQBBWWQBBWQQWBWQWWBBQBQWWQQQQBWWWWBQBWQBBQQBBBQWQB...
output:
67 73 35 33 61 10 66 78 59 67 19 51 69 44 81 25 116 56 64 99 65 49 89 92 81 45 IMPOSSIBLE 85 IMPOSSIBLE IMPOSSIBLE 69 87 81 68 63 31 45 97 81 18 99 IMPOSSIBLE IMPOSSIBLE 89 78 55 60 31 130 54 IMPOSSIBLE 95 76 97 47 79 99 48 109 43 57 93 92 79 IMPOSSIBLE 40 33 23 IMPOSSIBLE 100 74 30 97 53 74 IMPOSSI...
result:
ok 168 lines
Test #21:
score: 0
Accepted
time: 113ms
memory: 47256kb
input:
78 69 670 BQQWBWQWBBBBBQQBWBBQWQQBQWBWQWQWBWWWQGQBQQQWBQQQQQQBQBQBBBQWBBWQBBWWB QWWBBWQWQBWWQBWWQQWBQBQBBQWWWQWBWQQBWWBBWBWBWBQBBQQBWBBQWWQWWBBQQQWQQBBBWBWWWQBBWQWWQQQBBWBBWBBBQWBQBQWWWBBBWBQQQWWWBWBWQBWWBQBWWBBQBQWQQQQWWWWQBWBBBBWWBQWWBQBBQWWWQWBQWBBWQQQWWBWQBWQQWBWWQQWQWQWQQWQBQQWQQWWWWBBWWBQBQWBQ...
output:
97 110 56 121 157 129 110 70 190 72 136 155 116 108 133 158 132 91 101 107 195 IMPOSSIBLE 95 123 131 192 IMPOSSIBLE 21 82 149 129 IMPOSSIBLE 94 216 111 87 194 166 93 171 108 114 108 174 85 84 101 88 32 148 112 102 188 158 106 141 34 200 115 160 60 104 55 198 110 172 33 76 62 188 189 119 133 72 52 99...
result:
ok 78 lines
Test #22:
score: 0
Accepted
time: 267ms
memory: 92752kb
input:
38 50 2202 BBWWQBWWQBBWWBQWQWBQWBWBBGWBWQBWQQBWQQWQBWBQWQQQBQ WBBQQBBBQQQBBWQBBBQWBBBBWBWWQQQWWWQQWBBBQQBWBWWWQWQQWBQBBWBWBBBQQQBBBBQBWQWWQQWBWWWBWBBQWQBWQWBQWWBBQBBBQWBBWQQBWWWBWWWBBWBWWBQWWWQWQQQQWQWWWWQWQBBBWQQBQWBWBBWQQBQBQWQWBBQBQQWQQQQWQQQBQBWBBQQQQBWQWQBBWBQQBWBWQBWWBBBWBBQWBQWBBBBWWWQBWQWWQB...
output:
534 202 261 373 220 281 106 173 274 195 IMPOSSIBLE 297 154 169 527 255 531 447 144 195 189 24 75 81 52 243 136 254 IMPOSSIBLE 292 271 222 213 128 299 478 163 231
result:
ok 38 lines
Test #23:
score: 0
Accepted
time: 255ms
memory: 100432kb
input:
17 2449 1335 QQQBBBBWWWWBWWWBBWWQBWBWQWBBBQWQWWBWBQBBQWWQBBWQBWBBQQWBQQBQQQQBWWBQBBBQQQBWBQWBQQWWWQQBBWWWQQWWBQBQWBQQBQQQWBWWQBWWBWBQQBWQBWWWBWQBBBBBQWBQBQBQBQWWQWQBQQQBWWQBWQQBWQWQWWQQBWQWWQWBWBWBBBWQWBBBQWWBQQBQWQQBBWBWBBBWQQBWWQQQBBWWBWWWQBBWBQWWWBQBBWQWQBQQQQBBWWWQQWWBBWWQQQWQWWBQWBQQQQQBBBBWBQB...
output:
2449 1337 1453 1679 1004 662 552 1399 536 2156 606 2438 1992 1738 1194 2142 2214
result:
ok 17 lines
Test #24:
score: 0
Accepted
time: 7ms
memory: 9912kb
input:
156 455 9 QWQWQWBBBQQQQWBQWQBQWQBBBBWWQBBWWQBWQWBQBWQBQQBWBQBQBBQWWBWBQQWQQQBBBQBQWQWQQBQWBBWBBQWWBQWQQQQQQWBWWQQWQQBQBQBBWBWQQQWWQQQQWWQQWQQQBBBBBBBBQQQWWWWBQQQWBBBBWWBWWWBQBBQQWWWWQBWWWWBBWWQWQWBWQBBBQBWBQWQBBBWWWQWBBWBBBWWWBBWWBBBBWWBWQBQQBBWQQBWBWWBWBQQBQQBQBBBQWBWBQWQBQWQQQBBBWWQQWQQWQQQWQWWWWQ...
output:
455 298 372 237 185 256 189 236 433 399 245 29 83 498 60 404 104 147 413 173 114 339 64 78 172 89 357 96 401 371 439 342 465 287 399 492 340 300 369 272 26 460 379 277 122 205 138 438 152 123 270 206 152 399 147 201 252 24 183 308 76 428 304 304 375 115 17 240 259 236 96 64 397 358 500 334 113 466 2...
result:
ok 156 lines
Test #25:
score: 0
Accepted
time: 6ms
memory: 5920kb
input:
5915 3 7 WGB BQBQWWB 1 10 G WWWQWQQQBB 2 2 QG WQ 2 3 BG WBW 3 1 QBG Q 2 3 BG WQQ 4 1 QBGW Q 2 10 WG WQBWBBQQQQ 4 6 BQWG QWQBBW 3 10 GBQ WBQQQWQBBB 3 8 QWG QWQQBBBQ 4 1 WQBG Q 5 7 BBGWW WBBWQWB 4 1 BGQB B 2 8 GB BBWQWBQQ 5 6 BGWQB WWWQWW 1 2 G BQ 4 1 BBGQ W 2 10 QG BWQBBWBWBB 5 7 BBGWW BQWWWBQ 5 4 BQ...
output:
4 IMPOSSIBLE IMPOSSIBLE 3 3 3 4 IMPOSSIBLE 4 4 IMPOSSIBLE 4 5 4 4 5 IMPOSSIBLE 4 3 6 5 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 4 5 3 IMPOSSIBLE 4 4 3 5 IMPOSSIBLE 3 IMPOSSIBLE IMPOSSIBLE 4 IMPOSSIBLE IMPOSSIBLE 5 IMPOSSIBLE 4 3 IMPOSSIBLE IMPOSSIBLE 5 IMPOSSIBLE IMPOSSIBLE 4 IMPOSSIBLE IMPOSSIBLE IMPOSSIBL...
result:
ok 5915 lines
Test #26:
score: 0
Accepted
time: 6ms
memory: 5852kb
input:
5011 5 1 GQQBQ B 4 3 GQBB WWQ 4 2 WQQG BB 2 8 GB BWQQWBBQ 3 7 WWG BBQBWBW 6 9 QBQQBG WBBQQQBBB 6 2 QQBGQW QB 1 7 G BBQBQWW 5 3 BQWBG BBW 3 4 BQG BQWB 1 7 G QQQBBWB 4 7 GBBB QBQQWBW 2 6 QG WBBBWQ 2 11 QG WQQQQBBQWBB 4 4 GWQQ WBBW 3 3 WWG WQW 5 5 QBGWQ QQBQB 5 4 GWQBB WQBW 1 1 G Q 4 8 QBGW BWBWWBBB 2 ...
output:
5 4 4 4 IMPOSSIBLE 6 6 IMPOSSIBLE 5 3 IMPOSSIBLE 4 IMPOSSIBLE IMPOSSIBLE 4 IMPOSSIBLE 5 5 IMPOSSIBLE 4 IMPOSSIBLE 5 6 IMPOSSIBLE IMPOSSIBLE 3 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 2 4 IMPOSSIBLE 4 IMPOSSIBLE 6 IMPOSSIBLE 4 5 6 2 IMPOSSIBLE 5 IMPOSSIBLE 6 6 IMPOSSIBLE 7 2 6 4 4 4 6 I...
result:
ok 5011 lines
Test #27:
score: 0
Accepted
time: 2ms
memory: 5932kb
input:
4567 1 9 G QBQBWWBQQ 7 5 GBQWQBW BWWQW 10 6 QWGBQQBWWB WQBQQB 4 6 WGBW WWWBBQ 7 3 QGQBBQB WBB 6 4 WBWWBG BQBQ 6 2 QQWGWB BB 4 10 GBBW QQBQQWQBBW 10 9 QBQWQWBBQG QQBBBWWQB 7 7 GBQBWBB BBQBWWQ 9 3 WQQQBWBGQ QQB 9 5 BWWWWWQGW BWBQB 6 4 WQBGWW BWWW 5 6 WGQWQ BQQWQB 8 10 WBQQBQQG BBWQQQWQWQ 7 4 WWWGWQQ Q...
output:
IMPOSSIBLE 7 10 IMPOSSIBLE 7 6 6 4 10 7 9 9 6 5 8 IMPOSSIBLE 6 3 6 6 8 4 9 7 IMPOSSIBLE 10 5 6 5 5 IMPOSSIBLE 10 10 4 IMPOSSIBLE 4 7 2 10 9 10 4 3 5 4 9 8 3 9 9 IMPOSSIBLE 6 IMPOSSIBLE 10 7 IMPOSSIBLE 5 6 7 5 10 8 7 3 4 3 8 IMPOSSIBLE 5 3 IMPOSSIBLE 8 5 5 6 6 IMPOSSIBLE 3 IMPOSSIBLE 5 10 6 7 5 7 7 9...
result:
ok 4567 lines
Test #28:
score: 0
Accepted
time: 300ms
memory: 100936kb
input:
26 496 466 QQWQWWQBQWWBBWBWBWQQQBWBBQBBQBQBQWQBQQWBBWQWBQBWBBWQBQBBQQBWWBWQBBBWWWBWQBQQQQBWBWWWWQQBQWBWBQWBQQBBWQQBWWQWBBQBBBQBQWBBBWWQQWQQBWBBWWWWWQBQQQWWQQBBBQWWQBQBBQQQQBWBQWBBWWWQWWQWQBQQWBWWQWQWQWBQBQQQWQBBWWWBBWQQQWBWBWWQQQQBBWWBBWBBWWWBWBBWQWWWWWBWQWQQBQWWQQWQWWBWBQQWQBWWBWBQQBWQQBQWBQWWQQQBW...
output:
496 139 645 991 577 373 246 772 504 478 320 541 525 192 218 409 843 272 489 610 485 241 272 583 584 480
result:
ok 26 lines
Test #29:
score: 0
Accepted
time: 262ms
memory: 97304kb
input:
34 410 1517 BWBBWBBQBBBBBBQBBBQBBBBBBBBBBBWWQBBBBBBBBBWQBBQBQBBBBBQBQWWWBBQBBBBBBBBBQWBBBBWWBBBBBWBQBBWWWBBWBBWBBBQBQBQBBWWQBBBBWBQBBBQBBBWBWBBBBBBWBBWBWBBBQBQBBBBWWBBBBBWBWBBBBQBBBBBBBBBWQQBBBBBBBBBGQWQQQBBBBWBBBBWBBBQBBBWQBWQBBBBBBBBBBBBBBBBWBBQWWWBBBBBBBBBQBWBBQBQQBBBQBBBBBBBBWWWBBBBBBBBBQBWBBBBB...
output:
410 370 305 308 416 61 236 458 40 463 483 316 20 255 475 305 47 153 18 31 48 264 155 394 364 336 153 343 144 76 415 244 59 280
result:
ok 34 lines
Test #30:
score: 0
Accepted
time: 292ms
memory: 100144kb
input:
26 496 466 BWQBQBBBBBQBBBQBQBBBBQBBBQBBBBWBBQBQBBBBQBBBQBBBBBBQBBBBWQBBWBBBQBBBBBBBWBBWBBBQBBQQBBWBBBWBWBBBBBWBBQBBBBBBBBWWQQBBWBBBWBBWBBBBBBBBBBBBBWWBBBBBQBBBBBBBBBBBBBBBBBBBQBBBQBWWBBBBWBBBBQQBBBBBBQBBBBQBWBQBQBWBQBBBBBBBBBBBBQBBBBBWBWBBWBBWQBBBBBBBBBBQBBBBBBBBQBBBQBBBWBBBBBBBBBBBBBBBBBBBQBQWBBBQB...
output:
496 139 645 991 577 373 246 772 504 478 320 541 525 123 205 409 843 227 489 610 485 147 91 583 584 480
result:
ok 26 lines
Test #31:
score: 0
Accepted
time: 244ms
memory: 99820kb
input:
17 2449 1335 BWBBQBBQBWBQBBBBQBBBBBBBBBBBBBBBBBBBBBBWWBWBQWBQBBBWBBQBBBBQBWBBQBBBBWWWBBBBWBQBBBBBBBBWBBQWWWBBWBBBBWBBBBBBWBBWWBWBBBBBBBBBBBQBBBWBWWBWBQBBBBQBBBBBBBBBQBBBBBBBBBBBBBBQBBBBBBBBBBQQQBQBBWBQBQBBQWBBBBBQBBQQBBBBBBBBBBBQBBQBQBBBBBBBWBBBBBBBQBBBBBBBBWBBBBBBBBBBQBQBWBBWQBWBQBBBBBBBBBQQBBQBBBB...
output:
2449 1337 1453 1679 1004 662 552 1399 61 2156 606 2438 1992 1738 1194 2142 2214
result:
ok 17 lines
Test #32:
score: 0
Accepted
time: 274ms
memory: 101020kb
input:
37 3 387 GBB BBBBBBBBQBBBBBBBWWBBBBBBQBBBBBBBBBQBBWQBQWBBBWQQQBBBBBBBBBQBBWBBBQWBQQBBQBBBQBWWBBBBWBBBQBBBWBWBBWBBQBBBBBBBQBBBBBQBBQQBQBBQWQBQBBBBBBBQWBBQBBBBWBBBBBBBBBWWBBBBBBBBBBBBBQBQBQBBQBBBBBBBBBBWBBWBBBBBBBQBBBBBBBBBBBBBBWWBBWBQBBBBWBQBBBBQBWWBWBBBBBWBBQWBBWBBBBBBQBBQWBBBWBBWBBBBBBBBBBBBBQBBQQB...
output:
8 46 54 48 43 48 28 17 90 89 38 62 63 57 55 79 32 19 16 97 80 80 59 82 49 88 46 80 42 46 97 36 88 44 90 24 53
result:
ok 37 lines
Test #33:
score: 0
Accepted
time: 266ms
memory: 96732kb
input:
34 410 1517 QWQQWQQBQQQQQQBQQQBQQQQQQQQQQQWWBQQQQQQQQQWBQQBQBQQQQQBQBWWWQQBQQQQQQQQQBWQQQQWWQQQQQWQBQQWWWQQWQQWQQQBQBQBQQWWBQQQQWQBQQQBQQQWQWQQQQQQWQQWQWQQQBQBQQQQWWQQQQQWQWQQQQBQQQQQQQQQWBBQQQQQQQQQGBWBBBQQQQWQQQQWQQQBQQQWBQWBQQQQQQQQQQQQQQQQWQQBWWWQQQQQQQQQBQWQQBQBBQQQBQQQQQQQQWWWQQQQQQQQQBQWQQQQQ...
output:
410 370 305 308 416 61 236 458 40 463 483 316 72 255 475 305 IMPOSSIBLE 153 18 31 IMPOSSIBLE 264 155 394 364 336 153 343 144 76 415 244 59 280
result:
ok 34 lines
Test #34:
score: 0
Accepted
time: 298ms
memory: 101420kb
input:
26 496 466 QWBQBQQQQQBQQQBQBQQQQBQQQBQQQQWQQBQBQQQQBQQQBQQQQQQBQQQQWBQQWQQQBQQQQQQQWQQWQQQBQQBBQQWQQQWQWQQQQQWQQBQQQQQQQQWWBBQQWQQQWQQWQQQQQQQQQQQQQWWQQQQQBQQQQQQQQQQQQQQQQQQQBQQQBQWWQQQQWQQQQBBQQQQQQBQQQQBQWQBQBQWQBQQQQQQQQQQQQBQQQQQWQWQQWQQWBQQQQQQQQQQBQQQQQQQQBQQQBQQQWQQQQQQQQQQQQQQQQQQQBQBWQQQBQ...
output:
496 139 645 991 577 373 246 772 504 478 320 541 525 123 205 409 843 227 489 610 485 147 91 583 584 480
result:
ok 26 lines
Test #35:
score: 0
Accepted
time: 222ms
memory: 100156kb
input:
22 1484 646 QWQQWQQQQQWBWQWQQQBWQQQQQQQQQQQWQWBQWQWQQQQQQQQBQQWWQBQBQWQQQQQBQQQQBQQWBQQWQQQQWQQQQQQBQQQQQQQQBQQQQQQQQQQQWQBQQQQWQQQQQQQQBQWQBBQBQQQQQQQBQQQQQQQBQQWQWBQQQBQBWQQQQWQQQQQQQQQQWBQQQWQQQQQBQQBBQQWQQWQQQQQQQBQQQQWQQWQBQQQQWQQQQQQQQQWWWQBWQQQQQQQQWQQQQWQQWQQQQQQWQBQBQQQQQQQBQQQBBQQQQQQWQQQQ...
output:
1484 210 1095 1485 456 886 1401 203 844 1294 1356 1289 524 1075 837 1275 57 955 286 853 1320 1254
result:
ok 22 lines
Test #36:
score: 0
Accepted
time: 242ms
memory: 99456kb
input:
17 2449 1335 QWQQBQQBQWQBQQQQBQQQQQQQQQQQQQQQQQQQQQQWWQWQBWQBQQQWQQBQQQQBQWQQBQQQQWWWQQQQWQBQQQQQQQQWQQBWWWQQWQQQQWQQQQQQWQQWWQWQQQQQQQQQQQBQQQWQWWQWQBQQQQBQQQQQQQQQBQQQQQQQQQQQQQQBQQQQQQQQQQBBBQBQQWQBQBQQBWQQQQQBQQBBQQQQQQQQQQQBQQBQBQQQQQQQWQQQQQQQBQQQQQQQQWQQQQQQQQQQBQBQWQQWBQWQBQQQQQQQQQBBQQBQQQQ...
output:
2449 1337 1453 1679 1004 662 552 1399 61 2156 606 2438 1992 1738 1194 2142 2214
result:
ok 17 lines
Test #37:
score: 0
Accepted
time: 267ms
memory: 96672kb
input:
34 410 1517 QBQQBQQWQQQQQQWQQQWQQQQQQQQQQQBBWQQQQQQQQQBWQQWQWQQQQQWQWBBBQQWQQQQQQQQQWBQQQQBBQQQQQBQWQQBBBQQBQQBQQQWQWQWQQBBWQQQQBQWQQQWQQQBQBQQQQQQBQQBQBQQQWQWQQQQBBQQQQQBQBQQQQWQQQQQQQQQBWWQQQQQQQQQGWBWWWQQQQBQQQQBQQQWQQQBWQBWQQQQQQQQQQQQQQQQBQQWBBBQQQQQQQQQWQBQQWQWWQQQWQQQQQQQQBBBQQQQQQQQQWQBQQQQQ...
output:
410 370 305 308 416 61 236 458 40 463 483 316 IMPOSSIBLE 255 475 305 39 153 68 31 118 264 155 394 364 336 153 343 144 76 415 244 59 280
result:
ok 34 lines
Test #38:
score: 0
Accepted
time: 297ms
memory: 100148kb
input:
26 496 466 QBWQWQQQQQWQQQWQWQQQQWQQQWQQQQBQQWQWQQQQWQQQWQQQQQQWQQQQBWQQBQQQWQQQQQQQBQQBQQQWQQWWQQBQQQBQBQQQQQBQQWQQQQQQQQBBWWQQBQQQBQQBQQQQQQQQQQQQQBBQQQQQWQQQQQQQQQQQQQQQQQQQWQQQWQBBQQQQBQQQQWWQQQQQQWQQQQWQBQWQWQBQWQQQQQQQQQQQQWQQQQQBQBQQBQQBWQQQQQQQQQQWQQQQQQQQWQQQWQQQBQQQQQQQQQQQQQQQQQQQWQWBQQQWQ...
output:
496 139 645 991 577 373 246 772 504 478 320 541 525 123 205 409 843 227 489 610 485 147 91 583 584 480
result:
ok 26 lines
Test #39:
score: 0
Accepted
time: 236ms
memory: 99736kb
input:
22 1484 646 QBQQBQQQQQBWBQBQQQWBQQQQQQQQQQQBQBWQBQBQQQQQQQQWQQBBQWQWQBQQQQQWQQQQWQQBWQQBQQQQBQQQQQQWQQQQQQQQWQQQQQQQQQQQBQWQQQQBQQQQQQQQWQBQWWQWQQQQQQQWQQQQQQQWQQBQBWQQQWQWBQQQQBQQQQQQQQQQBWQQQBQQQQQWQQWWQQBQQBQQQQQQQWQQQQBQQBQWQQQQBQQQQQQQQQBBBQWBQQQQQQQQBQQQQBQQBQQQQQQBQWQWQQQQQQQWQQQWWQQQQQQBQQQQ...
output:
1484 210 1095 1485 456 886 1401 203 844 1294 1356 1289 524 1075 837 1275 57 955 286 853 1320 1254
result:
ok 22 lines
Test #40:
score: 0
Accepted
time: 250ms
memory: 101392kb
input:
17 2449 1335 QBQQWQQWQBQWQQQQWQQQQQQQQQQQQQQQQQQQQQQBBQBQWBQWQQQBQQWQQQQWQBQQWQQQQBBBQQQQBQWQQQQQQQQBQQWBBBQQBQQQQBQQQQQQBQQBBQBQQQQQQQQQQQWQQQBQBBQBQWQQQQWQQQQQQQQQWQQQQQQQQQQQQQQWQQQQQQQQQQWWWQWQQBQWQWQQWBQQQQQWQQWWQQQQQQQQQQQWQQWQWQQQQQQQBQQQQQQQWQQQQQQQQBQQQQQQQQQQWQWQBQQBWQBQWQQQQQQQQQWWQQWQQQQ...
output:
2449 1337 1453 1679 1004 662 552 1399 61 2156 606 2438 1992 1738 1194 2142 2214
result:
ok 17 lines
Test #41:
score: 0
Accepted
time: 303ms
memory: 101576kb
input:
19 1871 1477 QQQQQQQQQQQQQQWQQWBQQQQQQQQQWQQQQQWQQBQWBQQQQWQBQQWQQQQBQQQQWBQBBQQQBQQQQQQWQQQQQQQQQQWWQQQQWQQQBQQQQQQBBBQQQQWQQQQBQWQQQQQWQQQBQQWQWBQQQQWQWQQQWQWQQWQQQQQQQBQBWBQQQQQQQQWQQQWQWQQQQQWQQQQQQQQQQBWWQBQQQWWQQWBQQWWQWQBQQQQQBBQQQQBQQQQQBBQBWQQQQQQBQQQQQQQBQQBQQBQQQQQBWQQQQBQQQQQQQQQQBQQQWQB...
output:
1871 1780 572 1788 234 474 1378 59 989 1210 1103 1559 2225 2160 1886 1963 1143 95 1011
result:
ok 19 lines
Test #42:
score: 0
Accepted
time: 245ms
memory: 98960kb
input:
28 39 495 BQBQQQQQQQQQQQQQQQQBWBQQQQGQQQQBWBQQQQB BWQQQQQQWQQQQQQWQQBQQQQQBQQQQQQQBQBBQWWWQQQQQQWQQQWQQQBQQQQQQQQQBQBWWQQQWBQBQQQQQWQQQWQQBQQQQQQQQQBQQQQWQQQQQQQWQQQBQQQQQQQWQBQQQQQQQQQWQWWQQBBWQQQBQQQQQQWWWQQQQBBQQQWQQQQQBQWQQQWQQQBQQQQQWBBWQQQQQBWWQQQQWQQQQWQWQQBQQQQQQQQWWBQQBQQWWQQQQQQQQQQQQQQQWB...
output:
39 826 1092 440 364 1185 555 467 595 791 330 611 566 761 876 317 85 514 119 727 456 1058 1231 286 814 169 824 585
result:
ok 28 lines
Test #43:
score: 0
Accepted
time: 245ms
memory: 97560kb
input:
28 39 495 WQWQQQQQQQQQQQQQQQQWBWQQQQGQQQQWBWQQQQW WBQQQQQQBQQQQQQBQQWQQQQQWQQQQQQQWQWWQBBBQQQQQQBQQQBQQQWQQQQQQQQQWQWBBQQQBWQWQQQQQBQQQBQQWQQQQQQQQQWQQQQBQQQQQQQBQQQWQQQQQQQBQWQQQQQQQQQBQBBQQWWBQQQWQQQQQQBBBQQQQWWQQQBQQQQQWQBQQQBQQQWQQQQQBWWBQQQQQWBBQQQQBQQQQBQBQQWQQQQQQQQBBWQQWQQBBQQQQQQQQQQQQQQQBW...
output:
39 826 1092 440 364 1185 555 467 595 791 330 611 566 761 876 317 85 514 119 727 456 1058 1231 286 814 169 824 585
result:
ok 28 lines
Test #44:
score: 0
Accepted
time: 250ms
memory: 97184kb
input:
28 39 495 WBWBBBBBBBBBBBBBBBBWQWBBBBGBBBBWQWBBBBW WQBBBBBBQBBBBBBQBBWBBBBBWBBBBBBBWBWWBQQQBBBBBBQBBBQBBBWBBBBBBBBBWBWQQBBBQWBWBBBBBQBBBQBBWBBBBBBBBBWBBBBQBBBBBBBQBBBWBBBBBBBQBWBBBBBBBBBQBQQBBWWQBBBWBBBBBBQQQBBBBWWBBBQBBBBBWBQBBBQBBBWBBBBBQWWQBBBBBWQQBBBBQBBBBQBQBBWBBBBBBBBQQWBBWBBQQBBBBBBBBBBBBBBBQW...
output:
39 826 1092 440 364 1185 555 467 595 791 330 611 566 761 876 317 85 514 119 727 456 1058 1231 286 814 169 824 585
result:
ok 28 lines
Test #45:
score: 0
Accepted
time: 468ms
memory: 101512kb
input:
10 2500 2500 BBBQBBBBWBBWBBBBBBQBBBBBBQWBBWBBBBBBWBBBWBBBBBBBBBBWBBBBBBBBWBBBBBBBQBQBBBBWBWBBWBWBBBBQBWWWQBBBBQBBBBBBBBWWBBWQBBQBBBQBBBBBWWBBBBWBQBBWWBBQBBQBQBBWBWBBBBBBBWBBBBBBBBBQWBBBWQWBBBQBQBBQBBBBBBBBBWBBBWBQBBBBBQWBBBBBBBBBBQBWBBQBWBBWBBWBBQBBBQWBBBBQBQWBBBBBQBBBWWWQBBBBBBQBQQBBBBBWBBQBBWQBBQB...
output:
2500 2500 2500 2500 2500 2500 2500 2500 2500 2500
result:
ok 10 lines
Test #46:
score: 0
Accepted
time: 436ms
memory: 100368kb
input:
19 50 2500 BBBBBBBBBBBBWQBQBQBBBBQBBBBQQWQBBBWQBWBQGBBBBBBBBB QBBBBBBQBBBBBBBBBBQBQBBBBWBQWBBBBBBQBBBQBWQBBBBQBQWQBBBBBBBQBBWBBQBWWBQBBWWBWBBBBBBBBBWBBWQBWBWBBWBBWBWQBWBBBBBWBWBQBBBBBBWBBQBBBBQBBBBBBBQBWBWBBWBBWBBBBQWWWBBBWQBBWBBBBBBBBBBQBBBQBBBBQBBBQQBBBBWBBWWWBBBBBBBQBQWBBBBBBBBBBBBBBBBQWBBQBBBBQB...
output:
50 50 50 50 50 50 50 50 50 50 50 50 50 56 50 50 50 50 50
result:
ok 19 lines
Test #47:
score: 0
Accepted
time: 432ms
memory: 100336kb
input:
19 10 2500 BQBBBBBBWG BBBBQWQBBQQBBBBBBBBBBBBBWBWBBWBBBQBBBBBBBBBBQBBBBBBBBQBWWQBBBBWBBBBBBBBWBBBQWBBBBBBBBBBBBBWBBBBBBBBBBBWQBBWBBBBBBWBBBBBBBBBBBBBQQBBBBBBQBBBWBBQBBBBBBQBBBBBQBBBBBBBBBBBBWBBWBWWWBBBBBBBQBBQQBQBBQWBBWWBBBBBWBBQBWQBBWQBWBBQBBBBBQBBWBWBBBBBBQWBBBBWBBBBWBBBBBQWQBBBBBBWBBBBWWBQBWQBBBQ...
output:
60 46 36 43 49 46 43 45 48 42 45 48 38 43 49 51 46 47 42
result:
ok 19 lines
Test #48:
score: 0
Accepted
time: 455ms
memory: 100812kb
input:
19 100 2500 BQQQBBWWBQBWBBBBQBQBBBBBBBBWBBQBQBWBQBBBBGQBBBBBWBQBBBWWBBBQBBBBWBBQBBBBBQBBBBBBBBBBBBBBBWBBBBBBBQWB WBBBBBBBQBBBBBBBBBBBBBBWWBBWBQBBBBWBQBBBBQBWWBWBBBBBWBBQWBBWBBBBBBQBBQWBBBWBBWBBBBBBBBBBBBBQBBQQBQBWBBWBWBBQQQWBBBBBBBBBBBBBBBBBBQBBWBBBQBBQBBBBWBBBQBQBBBBBBWQBBBBBBWBWBWBBQBBBBBWWBBWBWBB...
output:
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
result:
ok 19 lines
Test #49:
score: 0
Accepted
time: 448ms
memory: 100496kb
input:
18 250 2500 BBQBQBQBBBWBBBBQBBBWBWWBBBBQBBBBBBBBBWWBBQBBBBBBBBWBBBQBQBQBWBWBBBBBBBBWBBBBBBQBBBBBBQBBBBBBBBBQWWBQBBBBBBBBQBBBBBBBWBBWBBQBBWBBBBBBBBBWBBBBBQBBQBBBBQBBWQBBBBWWBQWBBBBBBGWBBBBBQBWBBQBQBBBBWBBBBWBBBBBBBWBBBBBQBBBBBBBBBQBBBBBBQBBBBQBBBBBBBQBQWBBBBBWBBB QBBBBBBBQBBBQWBBBBBBWWWBBBBQBBBBBBBWB...
output:
250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250
result:
ok 18 lines
Test #50:
score: 0
Accepted
time: 476ms
memory: 101388kb
input:
10 2500 2500 QQQBQQQQWQQWQQQQQQBQQQQQQBWQQWQQQQQQWQQQWQQQQQQQQQQWQQQQQQQQWQQQQQQQBQBQQQQWQWQQWQWQQQQBQWWWBQQQQBQQQQQQQQWWQQWBQQBQQQBQQQQQWWQQQQWQBQQWWQQBQQBQBQQWQWQQQQQQQWQQQQQQQQQBWQQQWBWQQQBQBQQBQQQQQQQQQWQQQWQBQQQQQBWQQQQQQQQQQBQWQQBQWQQWQQWQQBQQQBWQQQQBQBWQQQQQBQQQWWWBQQQQQQBQBBQQQQQWQQBQQWBQQBQ...
output:
2500 2500 2500 2500 2500 2500 2500 2500 2500 2500
result:
ok 10 lines
Test #51:
score: 0
Accepted
time: 418ms
memory: 100560kb
input:
19 50 2500 QQQQQQQQQQQQWBQBQBQQQQBQQQQBBWBQQQWBQWQBGQQQQQQQQQ BQQQQQQBQQQQQQQQQQBQBQQQQWQBWQQQQQQBQQQBQWBQQQQBQBWBQQQQQQQBQQWQQBQWWQBQQWWQWQQQQQQQQQWQQWBQWQWQQWQQWQWBQWQQQQQWQWQBQQQQQQWQQBQQQQBQQQQQQQBQWQWQQWQQWQQQQBWWWQQQWBQQWQQQQQQQQQQBQQQBQQQQBQQQBBQQQQWQQWWWQQQQQQQBQBWQQQQQQQQQQQQQQQQBWQQBQQQQBQ...
output:
50 50 164 215 50 50 50 50 50 50 50 91 50 321 50 50 231 277 154
result:
ok 19 lines
Test #52:
score: 0
Accepted
time: 416ms
memory: 101132kb
input:
19 10 2500 QBQQQQQQWG QQQQBWBQQBBQQQQQQQQQQQQQWQWQQWQQQBQQQQQQQQQQBQQQQQQQQBQWWBQQQQWQQQQQQQQWQQQBWQQQQQQQQQQQQQWQQQQQQQQQQQWBQQWQQQQQQWQQQQQQQQQQQQQBBQQQQQQBQQQWQQBQQQQQQBQQQQQBQQQQQQQQQQQQWQQWQWWWQQQQQQQBQQBBQBQQBWQQWWQQQQQWQQBQWBQQWBQWQQBQQQQQBQQWQWQQQQQQBWQQQQWQQQQWQQQQQBWBQQQQQQWQQQQWWQBQWBQQQB...
output:
IMPOSSIBLE IMPOSSIBLE 169 IMPOSSIBLE IMPOSSIBLE 302 142 215 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 154 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 230 IMPOSSIBLE 267
result:
ok 19 lines
Test #53:
score: 0
Accepted
time: 442ms
memory: 101160kb
input:
19 100 2500 QBBBQQWWQBQWQQQQBQBQQQQQQQQWQQBQBQWQBQQQQGBQQQQQWQBQQQWWQQQBQQQQWQQBQQQQQBQQQQQQQQQQQQQQQWQQQQQQQBWQ WQQQQQQQBQQQQQQQQQQQQQQWWQQWQBQQQQWQBQQQQBQWWQWQQQQQWQQBWQQWQQQQQQBQQBWQQQWQQWQQQQQQQQQQQQQBQQBBQBQWQQWQWQQBBBWQQQQQQQQQQQQQQQQQQBQQWQQQBQQBQQQQWQQQBQBQQQQQQWBQQQQQQWQWQWQQBQQQQQWWQQWQWQQ...
output:
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
result:
ok 19 lines
Test #54:
score: 0
Accepted
time: 452ms
memory: 100644kb
input:
18 250 2500 QQBQBQBQQQWQQQQBQQQWQWWQQQQBQQQQQQQQQWWQQBQQQQQQQQWQQQBQBQBQWQWQQQQQQQQWQQQQQQBQQQQQQBQQQQQQQQQBWWQBQQQQQQQQBQQQQQQQWQQWQQBQQWQQQQQQQQQWQQQQQBQQBQQQQBQQWBQQQQWWQBWQQQQQQGWQQQQQBQWQQBQBQQQQWQQQQWQQQQQQQWQQQQQBQQQQQQQQQBQQQQQQBQQQQBQQQQQQQBQBWQQQQQWQQQ BQQQQQQQBQQQBWQQQQQQWWWQQQQBQQQQQQQWQ...
output:
250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250
result:
ok 18 lines
Test #55:
score: 0
Accepted
time: 453ms
memory: 101348kb
input:
13 1250 2500 BBBBBBBBQBBBBBBBBBBBQBBBBWBWWBBQBBBBBBBBQBBWBWQBQWBBBBBBQQBBQWBBWQBBBBBBBBBBBBBBBWBBBBBBQBBWBBBBBBBBBQBBQBBBBBBWBBBQBBBBWBWBBBBBBBBBBBBBBBBBBWBBBBBBBBBBBBBBBBBBBBBQWBBBBBQBWBBBWBBWBBBBBBQBBBBBWBBBBBQBBBBQBBQBBBQBBBBBWBBQBWBQBBWBBBWBWBBQBBWBWBBBBBBBWBBBWBBWWQBQBBBBBBBBBBBBQWBBQWBBBQBBBBQ...
output:
1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250
result:
ok 13 lines
Test #56:
score: 0
Accepted
time: 483ms
memory: 101424kb
input:
13 1250 2500 QQQQQQQQBQQQQQQQQQQQBQQQQWQWWQQBQQQQQQQQBQQWQWBQBWQQQQQQBBQQBWQQWBQQQQQQQQQQQQQQQWQQQQQQBQQWQQQQQQQQQBQQBQQQQQQWQQQBQQQQWQWQQQQQQQQQQQQQQQQQQWQQQQQQQQQQQQQQQQQQQQQBWQQQQQBQWQQQWQQWQQQQQQBQQQQQWQQQQQBQQQQBQQBQQQBQQQQQWQQBQWQBQQWQQQWQWQQBQQWQWQQQQQQQWQQQWQQWWBQBQQQQQQQQQQQQBWQQBWQQQBQQQQB...
output:
1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250
result:
ok 13 lines
Test #57:
score: 0
Accepted
time: 396ms
memory: 95968kb
input:
20 250 2250 QQBQQQQQQQWWQQQQWQQQQQQQBQQQQQQQWWWBQQBQQQWWGQBQQBQQQQQQQQQQQQQQQQQQQWQQQQQQQQQQWQQQQQQQQBQQQWQWQQQBQWQQWQQQQQWQQWBQQQQWWQWQQQQQBQQWQQQWQQQQQWQQQQQQQQQQQQBQWQWWQQQBWQWQQQQWQBQWWQQQWQBQQQQQBQQQBQQQQQQQQWQWWQQQBQQQQWQWQQQQQQQBQQQQQQQQQQQQQQQQWBBQWQQQQQ QQQQWBQQQQQWQBQQQQQQWBQQQQQBQQQQQQQQQ...
output:
250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250
result:
ok 20 lines
Test #58:
score: 0
Accepted
time: 396ms
memory: 92908kb
input:
20 250 2250 BBQBBBBBBBWWBBBBWBBBBBBBQBBBBBBBWWWQBBQBBBWWGBQBBQBBBBBBBBBBBBBBBBBBBWBBBBBBBBBBWBBBBBBBBQBBBWBWBBBQBWBBWBBBBBWBBWQBBBBWWBWBBBBBQBBWBBBWBBBBBWBBBBBBBBBBBBQBWBWWBBBQWBWBBBBWBQBWWBBBWBQBBBBBQBBBQBBBBBBBBWBWWBBBQBBBBWBWBBBBBBBQBBBBBBBBBBBBBBBBWQQBWBBBBB BBBBWQBBBBBWBQBBBBBBWQBBBBBQBBBBBBBBB...
output:
250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250
result:
ok 20 lines
Test #59:
score: 0
Accepted
time: 412ms
memory: 96264kb
input:
20 200 2300 QWQQQQQQGQQQQQQQQQQWQQQQQQQQQBQQQQQQQQWBQQWQWQQQBQQBQQQBQQQBQQWQQQQQQQQQQQQBQQQQQQQQQQQQQQQQQQQQQWQQQQQBQQQQQWQQQQQQQBBBWQQWBQBQWQQQQQQQBWQQQBQQQQQWQQQQQQQQQBQQBQQQQQQQQWWQQWQBQQWQQQQQQQQWQQQQQQQBQQQQ QQQQQQQQQQQQQWBBQQQQQBWQQQQQQWQQQQQQQQBQQQWQQQQQQQQQQWQQQBQQWQWQQQQWQQQQWQWQQQQQQQQQQQQ...
output:
200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200
result:
ok 20 lines
Test #60:
score: 0
Accepted
time: 414ms
memory: 95944kb
input:
20 200 2300 BWBBBBBBGBBBBBBBBBBWBBBBBBBBBQBBBBBBBBWQBBWBWBBBQBBQBBBQBBBQBBWBBBBBBBBBBBBQBBBBBBBBBBBBBBBBBBBBBWBBBBBQBBBBBWBBBBBBBQQQWBBWQBQBWBBBBBBBQWBBBQBBBBBWBBBBBBBBBQBBQBBBBBBBBWWBBWBQBBWBBBBBBBBWBBBBBBBQBBBB BBBBBBBBBBBBBWQQBBBBBQWBBBBBBWBBBBBBBBQBBBWBBBBBBBBBBWBBBQBBWBWBBBBWBBBBWBWBBBBBBBBBBBB...
output:
200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200
result:
ok 20 lines
Test #61:
score: 0
Accepted
time: 424ms
memory: 99076kb
input:
20 100 2400 WQQQQQQQQQWQQQQQQQQQBQQBBBBQQGWQWQQQBQQQQQQQQQQWQBQQQBQQQBQQQQQQWQQBQWQWBWQQQQQQWWQQWQQQQQQQQQBQQQQB QQQQQQQBQBQQBQQQWQQQQQBQQWQQBQBBQWQQQQBBQQQQQBWWQQQQQQBQQQWWQQQQWQQQWQWQQQWQQWQQWQBQQQQQQQQWWQQQBQQBQQQWBQQQQQQQQQQBQQQBQQQWQQQWQQQQQQQQQQWBQQQQQQQQQQQWQQQQWQQQQBQBQQQBQQQQQBQWQQQQQQQBQQW...
output:
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
result:
ok 20 lines
Test #62:
score: 0
Accepted
time: 428ms
memory: 100396kb
input:
20 100 2400 WBBBBBBBBBWBBBBBBBBBQBBQQQQBBGWBWBBBQBBBBBBBBBBWBQBBBQBBBQBBBBBBWBBQBWBWQWBBBBBBWWBBWBBBBBBBBBQBBBBQ BBBBBBBQBQBBQBBBWBBBBBQBBWBBQBQQBWBBBBQQBBBBBQWWBBBBBBQBBBWWBBBBWBBBWBWBBBWBBWBBWBQBBBBBBBBWWBBBQBBQBBBWQBBBBBBBBBBQBBBQBBBWBBBWBBBBBBBBBBWQBBBBBBBBBBBWBBBBWBBBBQBQBBBQBBBBBQBWBBBBBBBQBBW...
output:
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
result:
ok 20 lines
Test #63:
score: 0
Accepted
time: 429ms
memory: 99768kb
input:
20 50 2450 QQQWQQQQQWQQQQQQQWQWGBBQBQWQQQQQBQQQBQQQQQQBWQWBQQ QQQQQQQQQQBQQBQBQBQQQBWWBWBQWBWBQQBWWQQQQQWQQQWQQBQQQQQQQBQWQWQWQBQQBQQWQBBQBBQQWWQQQQQQQWBQQBQQQBQQWQQQWQQQQQQWQQQBQQBQWBBQQQQQQWQQQQQWQQBQQQWQQWQQQQQBQQQQQQQQBQBQWQQBQQWBQQBQQQWQQQBQQWBQQQWQQQQQQBBBWQQQWQQQQQQQQBBQWQQQQQQQQQQQQBWQQQQQQQ...
output:
50 50 50 IMPOSSIBLE 50 50 276 IMPOSSIBLE 52 84 56 50 115 50 50 154 56 54 53 61
result:
ok 20 lines
Test #64:
score: 0
Accepted
time: 447ms
memory: 99848kb
input:
20 50 2450 BBBWBBBBBWBBBBBBBWBWGQQBQBWBBBBBQBBBQBBBBBBQWBWQBB BBBBBBBBBBQBBQBQBQBBBQWWQWQBWQWQBBQWWBBBBBWBBBWBBQBBBBBBBQBWBWBWBQBBQBBWBQQBQQBBWWBBBBBBBWQBBQBBBQBBWBBBWBBBBBBWBBBQBBQBWQQBBBBBBWBBBBBWBBQBBBWBBWBBBBBQBBBBBBBBQBQBWBBQBBWQBBQBBBWBBBQBBWQBBBWBBBBBBQQQWBBBWBBBBBBBBQQBWBBBBBBBBBBBBQWBBBBBBB...
output:
50 50 50 71 50 50 52 50 50 50 50 50 50 50 50 50 55 50 50 54
result:
ok 20 lines
Test #65:
score: 0
Accepted
time: 444ms
memory: 101216kb
input:
20 10 2490 GBQQQQQWQQ QQQQWQQQQQBQQQQWQWQQWQQQWBBQQQQBQQQQQQQQQQQQQQQWWQQQQQQQQQQQQQQWQQQQWWBBQQQQQQQQQQQQQQQWQQWQWWQQWQBQQQQQQBQQQQQQQWQQQQQQWQBQWQBQQQQQBBWQWWBQQBQQQQBBQQQQQQQQBQQQQQQBQQWQQQWQQQQQQBQQBQQQQQWQQQQQWQQWQQQQWBQQQQQBQQQBQWQQWQQWQBQQWQQQQWWQWQQWQQQQQQWBQWQBQQQQWQWQWQQQQQQQQQQQQBQQQQQWQW...
output:
IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 217 94 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 272 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE
result:
ok 20 lines
Test #66:
score: 0
Accepted
time: 462ms
memory: 101256kb
input:
20 10 2490 GQBBBBBWBB BBBBWBBBBBQBBBBWBWBBWBBBWQQBBBBQBBBBBBBBBBBBBBBWWBBBBBBBBBBBBBBWBBBBWWQQBBBBBBBBBBBBBBBWBBWBWWBBWBQBBBBBBQBBBBBBBWBBBBBBWBQBWBQBBBBBQQWBWWQBBQBBBBQQBBBBBBBBQBBBBBBQBBWBBBWBBBBBBQBBQBBBBBWBBBBBWBBWBBBBWQBBBBBQBBBQBWBBWBBWBQBBWBBBBWWBWBBWBBBBBBWQBWBQBBBBWBWBWBBBBBBBBBBBBQBBBBBWBW...
output:
51 40 53 46 52 57 50 59 40 37 51 46 57 50 52 51 58 62 51 63
result:
ok 20 lines
Test #67:
score: 0
Accepted
time: 492ms
memory: 101388kb
input:
10 2500 2500 BQWBBBWBQWQBQBWQWBWBQQBBQWWQBWWQWQWQQWBBBQBQWQWWQQWWWWQBWWQWBWBQBQBBWWBQWQBWBQWQQBBWQWQWWQWBWQBWWQBWQBWQBBWQBBBBBQBWWQWBWBWBWBWQQQQQBQWQBQBQWQWWQBWQQWBQBBBWBWQQBBQBWBWWBBWQQQWWBQQQQQBBWWBQBWBQBQQBQWBBWQQQQBQQQWQQWWQQQBQBQQWQBBQBQWBWWBWBQQBWWWQWWBBBQQWQWWWWQQQBQBWQBBBQWWQBBQBWBQWWBBBQQBQ...
output:
2500 2500 2500 2500 2500 2500 2500 2500 2500 2500
result:
ok 10 lines
Test #68:
score: 0
Accepted
time: 481ms
memory: 101356kb
input:
13 1250 2500 BWQQWQBWQBQQQQQBWBWBWWWQQQWWQWBBQQWBBQWQWBQQQWBWQQWQQQWQBBBQWWQQBQBWQQWBWQWWQBBWBQQWWWWBQWQWWQBWBBBQBQWBBQBWWQBBWWWBBWWBWWWWWBWWWQBWQQBWQWBBQWWWQWWQWQWQWQQBQBWQWQQBWWQBBQWWQQWQQQBQQWQWQQBWWQWBQQBWBBWBWQQBWQWBQQBWQWQBBBBWBBWBWBQBQWWBBWWBWQQWBWWWWQWQQWBQQBQQBWQQQWBBWQBBQBQWQBWWBBQQQQWQQQQ...
output:
1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250
result:
ok 13 lines
Test #69:
score: 0
Accepted
time: 413ms
memory: 92996kb
input:
20 250 2250 BQWWWQWQBQWBWBWWWBWQBWWWWQBQBQWBQQQWBQBWBWQQGWQWQWQQQQQQWQBQWBQWQQWQWWWBQWQQBWQQQBWBBQBBWBWWQWQQQBQQQQQWQQWBBQWBQQWQBWWWWBWQWQWBBBWWQQBWWBWQWQQQBQQQBWBBWQBQWWWWQBBWBQWQBWBQWBBBQBWBQWWQQWWWBWQBQBQWBQQBBQQBWQBBBQWBWBBWWWQBWBBWQQWWBWQBWQBQQQBWWWQWBWBBWW WBQBQQQBQQWQQBBWBBWWBBWWBQQWWQQBBWQQW...
output:
271 257 270 289 327 291 278 303 277 318 313 286 314 308 277 287 297 319 283 289
result:
ok 20 lines
Test #70:
score: 0
Accepted
time: 412ms
memory: 96956kb
input:
20 200 2300 WBWBBBQWGQBWBQWBQWBQQQQWBWWWWQWBQWWBBQBQWBBBWBBWWWBBQWBBBWQQBQQWBWWWBBWWQQBQQBWQBQBWWWBBBWQQBQWQBQBQWQQWQBWBQQWQWWQWWWWQWQWBQBWQQBBBQBQQWWWWQQWWBWWWBWQBBWWWQBWWBQWWQWBWBBQQBWQBWWQWBBWWQQQQQBWBWQQWQWQW BWWWBQWWQBWBWQBBWQBQBQBQQQBBBBWBWWWWBBWQQQBQQQQWBWWQQBBBQBQQQBQWBQWQQQQQQBQWWWWWBWWQBWB...
output:
335 345 307 303 295 296 329 285 355 289 358 372 320 328 321 266 316 385 256 338
result:
ok 20 lines
Test #71:
score: 0
Accepted
time: 434ms
memory: 99432kb
input:
20 100 2400 BQWBWQWQWQWQWBBWQBQWBBQBQBQQQGBQQBWQBBWBBQWWQQQBQBQQQQBBQWQBWBBWQQWWWWBQQBQBBWBQQWBQQWQWQQWQBWWQQBWW BWWWBWWBQBBWBBQWBBBBQQBQQBQQBBQBWBWWQWQQWBBQWBQQWWQQBWBWWWQBWQQWBBBWQBBBQWWWQWQWQWQQWBWQQWQBWQWWWQWWWQBQQQWQWWWWBQWBBWQQWBWQQWBQBWQWWQQBBBWBQQBQQQWWBQBBWQWQBBWWWBWBBWQBQWBQWWBWQQWWQBBWQWQ...
output:
574 553 IMPOSSIBLE 417 571 574 549 751 663 505 481 587 475 606 454 580 420 442 717 450
result:
ok 20 lines
Test #72:
score: 0
Accepted
time: 441ms
memory: 100728kb
input:
20 50 2450 QQWBBBQQWQQQQBQQQBWQGWQWQQQBWBBWWQQWBWBQQQBQWWQQQQ QWBWQBBWWQWBBQQWBBQWBQWBQBBWBQBQQBQQWQWWBQWQWQWQBBQWWQBQWBQQQQQWBQQBQBWBQWWBQBBQWQBBBBBBBBWWQBWWBQWQBQBBBBQQWQBQWBQWWWQWWWQWBBQQBWWQWWBBWBQWBWBQQWBQWBQWWWBWWWBBQQWBWQQBWBBWWQQBWQQBBQQQQWWQQWBWBWBWQQBBWWWQWWBWWWWQWBBBBWBWBBWWBBBWBBWWWBWWBQ...
output:
644 640 IMPOSSIBLE 604 518 682 617 535 512 664 717 IMPOSSIBLE 742 IMPOSSIBLE 629 599 753 422 410 674
result:
ok 20 lines
Test #73:
score: 0
Accepted
time: 447ms
memory: 101184kb
input:
20 10 2490 GBBWBQWQBQ WBBBWQQQQQWWBBQQBBQQQWBBWWWBWQBBQBWBQWBQBWBBQBBWQQBBWBWWBBBBWQBBWWQBQWWQQQBBQQWWWWWQBBWWBWWWWQBQWQWBQBQWBWWBWBQBQQWBWWWQBBQBWBWWWWWBWQWQWQBWQQWBBQBWBBQBQWWWBQQBQWQQWWQWWWBWBQWBBBQBBWWQWWQQBQQWBBBWBQQWQWQWWQQWQWQBQQBWQQWQWBWBQWQBQQWQBWBWQBBWQQQBBBQQBBQQBWBQQQQWWBQBBBBWQWWBWQBWQB...
output:
692 IMPOSSIBLE 666 IMPOSSIBLE 675 IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE IMPOSSIBLE 587 IMPOSSIBLE IMPOSSIBLE
result:
ok 20 lines
Test #74:
score: 0
Accepted
time: 457ms
memory: 101512kb
input:
10 2500 2500 WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW...
output:
3749 3749 3749 3749 3749 3749 3749 3749 3749 3749
result:
ok 10 lines
Test #75:
score: 0
Accepted
time: 457ms
memory: 100316kb
input:
20 2 2498 GB WBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBW...
output:
1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250
result:
ok 20 lines
Extra Test:
score: 0
Extra Test Passed