QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#29489 | #2549. King's Palace | sinbad# | AC ✓ | 2032ms | 134456kb | C++ | 5.5kb | 2022-04-17 23:20:34 | 2022-04-28 15:09:57 |
Judging History
answer
// #define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const multiset<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
template <class T> auto vect(const T& v, int n) { return vector<T>(n, v); }
template <class T, class... D> auto vect(const T& v, int n, D... m) {
return vector<decltype(vect(v, m...))>(n, vect(v, m...));
}
using int64 = long long;
using int128 = __int128_t;
using ii = pair<int, int>;
#define SZ(x) (int)((x).size())
template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
// mt19937 mrand(random_device{}());
// int rnd(int x) { return mrand() % x; }
mt19937_64 mrand(random_device{}());
int64 rnd(int64 x) { return mrand() % x; }
int lg2(int64 x) { return sizeof(int64) * 8 - 1 - __builtin_clzll(x); }
template <class T> void out(const vector<T>& a) { for (int i = 0; i < SZ(a); ++i) cout << a[i] << " \n"[i + 1 == SZ(a)]; }
template <class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template <class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template <class T> void dedup(vector<T>& v) { sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); }
void add_mod(int& x, int y) { x += y; if (x >= MOD) x -= MOD; }
void sub_mod(int& x, int y) { x += MOD - y; if (x >= MOD) x -= MOD; }
struct fast_ios {
fast_ios() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
};
} fast_ios_;
int main() {
int n, m;
cin >> n >> m;
const string s = "RGB";
auto g = vect<int>(0, n * 3, n * 3);
for (int i = 0; i < m; ++i) {
int x, y;
string sx, sy;
cin >> x >> sx >> y >> sy;
--x; --y;
int kx = s.find(sx[0]), ky = s.find(sy[0]);
g[x * 3 + kx][y * 3 + ky] = 1;
}
int L = min(n, 14), R = n - L, len = 3 * R;
vector<int> p3(n + 1);
for (int i = 0; i <= n; ++i) p3[i] = i == 0 ? 1 : p3[i - 1] * 3;
vector<int> c(n);
vector<int64> dp(1 << len);
for (int S = 0; S < p3[L]; ++S) {
for (int i = 0, T = S; i < L; ++i, T /= 3) c[i] = T % 3;
bool ok = 1;
for (int i = 0; i < L && ok; ++i) {
for (int j = i + 1; j < L && ok; ++j) {
if (g[i * 3 + c[i]][j * 3 + c[j]]) ok = 0;
}
}
if (!ok) continue;
int maskR = 0;
for (int i = 0; i < L; ++i) {
int x = i * 3 + c[i];
for (int y = 3 * L; y < 3 * n; ++y) {
if (g[x][y]) {
int j = y / 3 - L, cj = y % 3;
maskR |= (1 << cj) << (j * 3);
}
}
}
maskR = (1 << len) - 1 - maskR;
// trace(S, maskR, len);
dp[maskR]++;
}
trace("L done", len);
for (int i = 0; i < len; ++i) {
for (int S = (1 << len) - 1; S >= 0; --S) {
if ((S >> i) & 1) dp[S ^ (1 << i)] += dp[S];
}
}
trace("sos done", dp[0], dp[(1 << len) - 1]);
int64 ret = 0;
for (int S = 0; S < p3[R]; ++S) {
for (int i = 0, T = S; i < R; ++i, T /= 3) c[L + i] = T % 3;
bool ok = 1;
for (int i = L; i < n && ok; ++i) {
for (int j = i + 1; j < n && ok; ++j) {
if (g[i * 3 + c[i]][j * 3 + c[j]]) ok = 0;
}
}
if (!ok) continue;
int maskR = 0;
for (int i = 0; i < R; ++i) maskR |= (1 << c[L + i]) << (3 * i);
ret += dp[maskR];
}
cout << ret << '\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 3644kb
input:
2 3 1 R 2 R 1 G 2 R 1 B 2 G
output:
6
result:
ok answer is '6'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
1 0
output:
3
result:
ok answer is '3'
Test #3:
score: 0
Accepted
time: 1995ms
memory: 134292kb
input:
22 0
output:
31381059609
result:
ok answer is '31381059609'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
4 12 2 R 3 R 1 B 2 B 2 R 3 B 3 R 4 R 1 B 4 G 1 R 3 B 3 G 4 B 2 G 3 G 1 B 2 R 1 G 2 R 1 R 3 G 1 G 3 B
output:
13
result:
ok answer is '13'
Test #5:
score: 0
Accepted
time: 3ms
memory: 3516kb
input:
2 4 1 G 2 G 1 B 2 R 1 R 2 G 1 B 2 B
output:
5
result:
ok answer is '5'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
5 77 3 B 5 B 2 G 5 G 4 R 5 G 1 G 2 B 1 R 4 R 4 B 5 G 2 B 3 G 2 G 5 B 1 R 3 G 2 R 5 R 3 B 4 R 1 R 2 B 3 G 4 G 1 B 5 G 3 R 5 G 3 G 4 B 1 B 4 G 4 B 5 R 2 R 4 G 1 G 4 B 2 G 3 R 2 R 5 B 1 G 2 R 2 B 4 R 2 R 3 R 3 B 5 G 2 G 3 G 1 R 3 R 1 R 5 G 2 G 3 B 3 B 4 B 4 R 5 B 1 R 2 G 3 G 5 R 1 R 2 R 2 B 5 B 3 B 5 R...
output:
0
result:
ok answer is '0'
Test #7:
score: 0
Accepted
time: 3ms
memory: 3652kb
input:
10 141 3 B 9 B 1 R 8 R 4 B 8 R 2 B 4 R 2 R 7 B 6 B 9 R 1 R 9 R 4 R 8 G 3 B 8 R 3 B 5 G 4 B 9 B 4 G 5 R 2 R 3 G 7 B 8 G 5 B 7 R 7 B 8 R 2 B 8 B 7 R 10 B 2 G 10 G 6 G 8 B 1 R 4 B 8 R 10 B 2 G 3 B 2 B 5 B 3 R 4 R 3 B 7 R 3 R 7 R 2 R 10 R 3 G 9 G 5 B 10 G 6 R 8 B 3 R 9 G 1 B 10 G 3 R 8 G 1 B 3 R 4 R 9 R...
output:
0
result:
ok answer is '0'
Test #8:
score: 0
Accepted
time: 581ms
memory: 134292kb
input:
22 2079 1 R 2 R 1 R 2 G 1 R 2 B 1 G 2 R 1 G 2 G 1 G 2 B 1 B 2 R 1 B 2 G 1 B 2 B 1 R 3 R 1 R 3 G 1 R 3 B 1 G 3 R 1 G 3 G 1 G 3 B 1 B 3 R 1 B 3 G 1 B 3 B 1 R 4 R 1 R 4 G 1 R 4 B 1 G 4 R 1 G 4 G 1 G 4 B 1 B 4 R 1 B 4 G 1 B 4 B 1 R 5 R 1 R 5 G 1 R 5 B 1 G 5 R 1 G 5 G 1 G 5 B 1 B 5 R 1 B 5 G 1 B 5 B 1 R ...
output:
0
result:
ok answer is '0'
Test #9:
score: 0
Accepted
time: 3ms
memory: 3712kb
input:
4 52 1 G 2 B 2 G 4 R 1 G 4 B 1 G 3 G 3 B 4 B 2 R 4 B 2 G 3 G 3 B 4 R 1 B 2 B 1 G 4 G 3 G 4 B 1 B 4 R 3 R 4 G 2 B 4 B 1 G 2 G 3 G 4 G 2 R 3 R 1 R 3 G 2 R 4 G 2 B 3 B 2 B 3 G 2 R 3 G 1 B 3 G 1 G 4 R 1 G 2 R 2 G 4 B 1 G 3 R 1 R 2 R 1 R 2 G 1 R 4 G 2 R 4 R 2 B 3 R 1 B 3 B 2 B 4 R 3 R 4 R 2 G 4 G 3 B 4 G...
output:
0
result:
ok answer is '0'
Test #10:
score: 0
Accepted
time: 3ms
memory: 3584kb
input:
8 10 1 G 7 R 7 R 8 G 3 R 6 R 3 G 4 R 5 B 8 R 4 B 6 G 2 G 5 B 1 R 2 B 7 G 8 G 3 G 5 R
output:
1874
result:
ok answer is '1874'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
4 40 2 G 3 G 1 R 4 R 3 G 4 G 1 R 3 R 1 G 2 G 2 R 3 R 3 R 4 R 1 G 2 B 1 B 4 R 1 B 3 R 1 G 4 R 2 R 4 G 1 B 2 R 1 B 4 G 1 G 3 R 1 G 4 G 2 G 3 B 1 B 2 G 1 R 3 G 1 R 2 B 1 B 3 B 2 B 3 R 1 B 3 G 1 G 4 B 1 G 3 G 2 G 3 R 1 R 4 G 2 B 4 B 2 G 4 R 3 R 4 B 2 R 4 B 1 R 2 G 2 B 4 R 1 B 2 B 1 G 3 B 2 G 4 B 1 R 3 B...
output:
0
result:
ok answer is '0'
Test #12:
score: 0
Accepted
time: 3ms
memory: 3576kb
input:
2 3 1 B 2 B 1 R 2 R 1 G 2 R
output:
6
result:
ok answer is '6'
Test #13:
score: 0
Accepted
time: 3ms
memory: 3560kb
input:
3 24 1 R 2 B 1 B 3 B 2 G 3 B 1 B 2 G 1 B 2 B 2 R 3 G 1 G 3 B 2 B 3 R 1 R 3 R 2 R 3 R 1 B 3 R 1 B 3 G 1 R 3 B 2 R 3 B 2 B 3 B 1 R 2 R 2 G 3 G 2 B 3 G 1 G 2 G 1 G 3 G 1 G 2 R 2 G 3 R 1 G 2 B 1 R 3 G
output:
0
result:
ok answer is '0'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3720kb
input:
9 176 2 G 3 R 1 G 4 R 4 B 5 G 5 G 7 B 8 G 9 R 1 R 4 B 4 B 8 B 1 B 5 B 6 B 8 B 2 G 6 G 2 B 8 B 1 R 9 B 2 B 8 G 1 G 4 G 1 B 3 R 3 R 7 B 7 B 8 B 5 B 6 R 6 R 9 R 5 R 7 G 4 G 9 B 3 G 9 G 1 R 6 R 1 G 3 G 3 R 6 R 4 G 5 R 4 G 7 B 2 G 8 B 1 B 9 R 3 G 8 R 3 R 5 G 5 R 9 R 3 G 5 R 1 R 4 R 4 B 7 B 3 R 9 R 2 B 4 ...
output:
0
result:
ok answer is '0'
Test #15:
score: 0
Accepted
time: 1084ms
memory: 134360kb
input:
22 38 12 G 17 B 1 G 20 R 9 B 20 G 15 G 19 B 11 B 22 R 13 R 19 G 21 R 22 B 4 G 11 B 9 R 10 R 8 R 15 B 1 G 16 B 13 R 19 B 1 G 11 G 9 R 11 G 7 B 8 G 9 R 18 G 3 G 13 B 3 G 14 B 10 R 16 R 14 G 16 B 3 R 9 R 18 R 21 B 11 B 20 G 1 G 10 G 2 R 16 G 6 B 20 R 4 B 20 B 8 G 10 B 7 R 11 R 16 G 18 G 3 B 8 B 11 R 22...
output:
258518109
result:
ok answer is '258518109'
Test #16:
score: 0
Accepted
time: 474ms
memory: 3708kb
input:
18 25 16 G 17 B 1 G 14 B 7 G 10 R 11 R 12 B 5 G 18 B 8 R 16 R 11 G 15 B 4 R 8 G 13 G 15 G 8 R 11 G 3 G 4 R 1 B 16 B 6 B 17 R 5 G 16 R 7 R 8 G 12 B 18 G 9 R 18 R 4 B 15 R 6 R 17 B 6 B 7 G 4 B 15 G 2 B 13 R 2 R 8 R 1 G 12 B 3 R 5 G
output:
21513056
result:
ok answer is '21513056'
Test #17:
score: 0
Accepted
time: 3ms
memory: 3580kb
input:
2 6 1 G 2 R 1 B 2 B 1 R 2 R 1 R 2 G 1 B 2 G 1 R 2 B
output:
3
result:
ok answer is '3'
Test #18:
score: 0
Accepted
time: 4ms
memory: 3588kb
input:
11 201 4 B 9 R 2 B 7 G 1 G 9 G 5 G 8 G 3 G 4 G 1 R 7 R 3 R 7 R 7 G 9 G 2 B 8 G 5 B 7 B 4 G 8 G 4 G 5 B 5 B 9 R 4 R 11 G 2 B 10 B 7 G 11 B 6 G 7 G 7 G 11 G 3 B 8 R 8 R 10 R 3 R 10 B 7 G 8 R 2 R 4 R 9 R 10 R 2 G 11 R 3 B 5 R 3 B 10 G 1 B 9 R 4 G 7 G 10 B 11 B 4 B 6 G 3 B 9 G 4 R 9 B 1 G 10 B 1 G 2 B 6...
output:
0
result:
ok answer is '0'
Test #19:
score: 0
Accepted
time: 722ms
memory: 5344kb
input:
20 12 6 B 12 G 7 B 15 R 14 R 17 G 8 B 14 G 2 G 9 R 7 G 8 G 9 G 12 G 3 R 9 B 18 B 20 B 8 G 20 R 3 R 7 G 3 R 12 R
output:
875184912
result:
ok answer is '875184912'
Test #20:
score: 0
Accepted
time: 558ms
memory: 134360kb
input:
22 1804 6 B 11 R 1 G 18 R 12 B 17 G 5 G 22 G 14 G 21 R 11 G 19 B 18 G 21 G 9 R 13 B 2 R 20 G 2 R 8 R 2 G 6 R 7 G 16 R 13 R 14 B 2 B 17 R 3 R 21 B 3 B 5 R 2 B 12 G 18 R 20 G 1 G 22 B 14 R 17 B 6 R 10 B 1 R 13 B 10 G 11 R 2 G 20 G 17 R 19 G 5 G 15 B 19 R 20 G 6 G 17 B 11 R 16 B 3 R 15 B 6 G 19 B 13 R ...
output:
0
result:
ok answer is '0'
Test #21:
score: 0
Accepted
time: 3ms
memory: 3640kb
input:
8 163 3 R 6 G 2 R 8 G 4 B 5 G 1 G 2 R 1 G 3 R 2 R 5 R 1 R 3 B 1 R 6 B 2 B 5 G 4 R 8 G 3 R 4 B 4 R 5 B 1 G 4 B 4 R 5 G 6 G 8 G 2 R 3 B 1 R 7 B 2 B 6 G 2 R 6 B 2 B 5 B 3 B 5 R 3 B 7 B 3 G 5 R 6 G 7 B 1 B 7 B 2 B 8 R 4 G 6 G 7 R 8 B 2 G 3 G 2 R 4 G 2 B 3 B 7 G 8 B 5 R 6 B 1 B 8 R 1 R 8 B 1 B 2 R 6 B 8 ...
output:
0
result:
ok answer is '0'
Test #22:
score: 0
Accepted
time: 88ms
memory: 3576kb
input:
16 272 10 B 11 G 7 B 15 G 3 R 6 B 3 R 11 B 11 B 13 R 5 G 11 G 6 R 13 G 6 G 11 R 1 B 8 B 12 R 16 R 4 R 8 B 14 B 15 G 9 B 15 B 2 R 9 B 2 G 12 R 12 R 13 B 2 B 7 R 1 G 5 B 1 B 10 R 6 R 12 B 3 B 13 R 5 B 14 R 7 R 8 B 10 R 15 G 13 B 16 R 5 B 10 R 7 G 13 R 6 G 8 B 2 R 8 G 6 G 16 R 6 B 7 R 1 B 9 B 3 G 7 R 7...
output:
0
result:
ok answer is '0'
Test #23:
score: 0
Accepted
time: 5ms
memory: 3572kb
input:
12 263 3 G 9 R 5 R 8 B 4 G 11 R 6 B 11 G 11 B 12 R 5 R 11 B 10 G 12 G 4 R 11 B 2 G 8 B 8 R 9 B 4 R 6 R 2 B 3 R 7 B 9 G 2 G 10 G 9 G 10 G 6 G 8 B 7 R 10 G 4 G 11 B 7 G 12 B 1 B 12 R 1 R 10 G 5 G 10 R 5 B 7 G 10 R 12 R 7 B 8 G 2 R 4 G 4 R 5 B 5 G 12 B 8 B 12 R 7 B 10 R 2 R 11 R 4 B 6 G 7 B 9 B 5 G 6 B...
output:
0
result:
ok answer is '0'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
4 54 1 G 4 R 1 R 3 R 2 B 4 B 2 G 3 R 2 R 3 G 2 R 3 B 1 B 3 G 2 B 3 G 3 B 4 B 3 G 4 G 1 R 3 B 2 R 3 R 2 B 3 B 2 G 4 R 1 G 4 B 1 R 2 B 3 G 4 R 2 R 4 B 1 G 3 G 2 B 4 G 2 G 4 G 1 B 4 R 1 B 3 B 1 R 4 R 2 G 3 B 2 B 4 R 1 R 2 G 1 R 2 R 3 R 4 G 1 G 2 G 2 G 4 B 2 R 4 R 3 B 4 R 3 R 4 R 1 B 2 R 1 R 4 G 1 G 2 R...
output:
0
result:
ok answer is '0'
Test #25:
score: 0
Accepted
time: 501ms
memory: 3664kb
input:
19 20 12 B 14 G 7 R 15 B 7 B 13 R 5 B 18 R 3 R 5 B 1 R 17 R 2 G 6 G 4 B 6 B 11 G 18 G 6 R 8 B 13 R 19 G 2 G 10 R 3 G 10 R 10 G 13 B 7 R 9 B 12 G 17 G 8 G 14 G 2 B 16 G 14 B 16 G 5 G 14 G
output:
111329984
result:
ok answer is '111329984'
Test #26:
score: 0
Accepted
time: 744ms
memory: 5348kb
input:
20 21 4 B 8 R 4 R 10 R 5 G 15 G 4 B 13 R 18 G 20 B 8 G 17 R 7 B 9 G 9 G 15 B 18 G 19 R 6 B 17 B 14 B 16 R 2 G 13 G 1 B 17 B 4 G 20 R 9 R 17 B 3 R 15 B 9 B 12 B 4 B 11 R 10 R 16 R 10 B 17 G 8 R 11 B
output:
267962040
result:
ok answer is '267962040'
Test #27:
score: 0
Accepted
time: 641ms
memory: 3688kb
input:
18 17 5 R 6 B 9 G 13 G 12 B 17 G 11 B 17 R 12 G 16 R 2 B 11 B 9 B 17 R 3 B 7 R 3 G 16 R 14 R 16 G 10 R 15 B 1 B 15 R 2 G 18 B 5 B 9 B 4 G 11 R 6 B 15 G 8 R 12 B
output:
50671200
result:
ok answer is '50671200'
Test #28:
score: 0
Accepted
time: 849ms
memory: 19592kb
input:
21 22 10 G 16 R 4 B 19 G 7 G 18 G 12 R 20 R 8 B 9 R 2 G 18 R 3 R 6 B 2 G 9 B 20 B 21 R 19 R 20 G 4 B 5 R 2 G 15 R 9 R 11 R 1 B 15 R 3 G 10 G 10 B 12 B 13 R 16 R 14 B 20 B 3 B 15 B 12 G 17 B 17 G 19 B 1 G 20 R
output:
665745048
result:
ok answer is '665745048'
Test #29:
score: 0
Accepted
time: 713ms
memory: 5180kb
input:
20 22 10 R 13 R 16 B 17 B 3 B 17 R 3 G 13 R 7 G 19 R 4 R 14 R 11 R 12 G 5 B 11 R 7 B 15 B 4 B 16 R 7 R 16 R 6 G 11 B 5 R 15 G 6 R 20 R 1 G 9 G 8 G 12 B 13 G 18 G 1 G 5 B 2 G 19 R 5 B 20 B 12 R 17 G 2 B 18 B
output:
215418240
result:
ok answer is '215418240'
Test #30:
score: 0
Accepted
time: 1365ms
memory: 134276kb
input:
22 24 9 G 21 B 8 B 22 G 18 G 19 B 5 R 20 R 5 B 15 R 5 R 8 B 5 R 12 R 16 B 19 B 4 B 14 B 10 R 18 B 11 R 12 B 3 R 7 R 5 R 19 G 9 B 11 B 4 G 22 B 3 B 15 R 2 R 15 R 1 G 20 R 10 G 17 R 5 R 13 R 6 R 19 R 1 G 7 B 3 G 21 R 8 R 16 G
output:
2114213004
result:
ok answer is '2114213004'
Test #31:
score: 0
Accepted
time: 719ms
memory: 19524kb
input:
21 21 9 B 12 B 10 B 11 B 5 B 16 R 2 B 7 B 3 B 11 B 1 G 11 R 16 R 17 G 6 R 15 R 3 G 17 R 17 R 19 R 13 B 18 G 3 R 14 B 13 R 16 R 8 G 13 R 9 B 13 R 7 B 20 R 16 R 21 G 5 B 7 B 4 B 5 B 7 R 15 B 2 G 17 R
output:
1187593920
result:
ok answer is '1187593920'
Test #32:
score: 0
Accepted
time: 711ms
memory: 19464kb
input:
21 23 17 G 20 R 12 B 16 R 14 B 18 R 11 G 17 R 16 B 20 B 18 G 21 B 3 R 17 R 2 B 19 B 3 R 21 G 3 G 4 B 8 G 10 R 7 G 11 G 9 R 19 R 4 G 5 R 6 G 9 R 4 R 8 G 5 B 6 B 1 R 18 B 12 G 15 B 13 R 15 B 5 B 12 R 4 R 19 R 1 B 6 R
output:
583976832
result:
ok answer is '583976832'
Test #33:
score: 0
Accepted
time: 1443ms
memory: 134288kb
input:
22 21 9 R 14 B 1 R 20 R 21 R 22 R 10 G 12 R 9 R 22 R 9 B 19 R 18 B 21 G 7 R 11 B 2 B 9 G 5 G 13 G 11 R 12 R 10 G 20 G 6 G 9 G 1 B 16 G 8 G 22 R 7 R 21 G 4 G 19 R 6 B 15 R 5 G 15 R 3 R 21 G 5 G 17 G
output:
3429459648
result:
ok answer is '3429459648'
Test #34:
score: 0
Accepted
time: 582ms
memory: 19592kb
input:
21 23 7 B 16 G 2 R 11 B 2 G 18 B 8 R 15 G 10 R 14 R 4 G 16 B 3 R 4 R 4 G 11 R 2 B 8 B 9 R 11 B 11 R 12 R 2 R 17 R 4 R 19 B 4 G 10 R 3 B 21 B 7 G 20 R 6 R 7 B 1 R 20 G 13 G 20 R 1 R 5 R 5 G 10 R 4 B 7 R 13 G 16 B
output:
639060192
result:
ok answer is '639060192'
Test #35:
score: 0
Accepted
time: 1023ms
memory: 134288kb
input:
22 23 11 R 14 G 7 G 12 R 2 B 10 B 5 G 19 G 13 R 15 G 1 G 12 R 14 G 15 R 7 R 14 R 6 R 21 R 3 B 8 R 18 R 20 B 3 B 14 B 6 G 19 R 7 B 9 B 7 B 19 G 2 B 8 G 5 B 22 G 12 R 17 B 2 R 4 G 7 R 20 B 14 R 16 B 2 G 13 G 4 R 8 B
output:
1854480384
result:
ok answer is '1854480384'
Test #36:
score: 0
Accepted
time: 512ms
memory: 19524kb
input:
21 21 14 G 17 G 3 G 5 R 11 R 13 G 2 G 7 G 1 R 10 G 15 B 18 B 4 B 5 G 3 R 7 R 11 G 20 G 2 G 11 G 5 G 9 B 8 R 9 B 6 G 8 R 13 R 19 R 2 B 17 R 3 G 21 G 1 B 5 B 8 B 12 B 16 G 18 R 5 B 18 G 4 B 11 R
output:
795882456
result:
ok answer is '795882456'
Test #37:
score: 0
Accepted
time: 1231ms
memory: 134456kb
input:
22 23 15 G 22 B 13 G 21 R 10 G 11 G 18 B 19 G 2 B 3 B 14 R 21 R 2 G 6 B 2 R 16 R 11 G 20 G 11 G 13 G 3 B 11 R 11 G 17 R 5 G 9 B 4 G 21 B 1 G 19 G 7 R 22 B 17 G 22 G 1 B 22 B 2 G 8 R 2 G 9 R 7 G 12 G 7 B 22 R 2 G 9 G
output:
2386498896
result:
ok answer is '2386498896'
Test #38:
score: 0
Accepted
time: 736ms
memory: 19592kb
input:
21 23 6 B 16 R 4 R 9 R 5 R 15 B 4 B 20 G 9 B 15 R 7 G 21 B 5 G 18 B 6 B 10 R 5 G 13 R 15 G 21 B 6 B 9 G 5 R 14 G 8 B 18 R 2 R 10 R 1 G 17 G 12 G 15 R 19 B 20 G 1 R 7 G 3 G 16 G 11 R 12 G 4 G 21 G 16 R 19 R 6 G 8 G
output:
661173792
result:
ok answer is '661173792'
Test #39:
score: 0
Accepted
time: 460ms
memory: 3608kb
input:
18 18 10 G 12 B 4 R 11 B 7 R 12 B 5 B 15 R 6 R 9 B 9 R 17 B 1 G 15 G 8 R 17 G 7 R 18 G 1 R 9 B 6 G 10 R 3 R 9 G 4 B 8 G 7 R 13 R 2 R 7 R 13 R 16 R 9 R 14 B 3 B 13 R
output:
47105064
result:
ok answer is '47105064'
Test #40:
score: 0
Accepted
time: 730ms
memory: 19432kb
input:
21 20 6 G 11 B 5 G 9 B 4 G 14 R 15 R 18 R 6 G 7 R 1 R 21 G 3 B 7 B 11 G 12 B 4 B 20 R 3 G 4 B 10 R 17 B 9 R 13 G 14 B 15 B 4 B 17 B 13 B 21 R 5 R 17 R 5 B 19 G 3 G 8 B 7 R 16 B 2 B 21 R
output:
908390772
result:
ok answer is '908390772'
Test #41:
score: 0
Accepted
time: 542ms
memory: 3696kb
input:
18 17 4 B 15 R 4 B 16 R 5 R 14 G 16 B 17 G 7 G 8 B 9 R 14 B 8 R 14 B 3 B 9 R 1 R 14 B 3 B 16 R 10 G 18 G 10 G 11 G 12 G 17 R 14 R 18 B 1 G 2 B 4 R 13 G 6 B 8 R
output:
52441092
result:
ok answer is '52441092'
Test #42:
score: 0
Accepted
time: 575ms
memory: 5180kb
input:
20 21 9 B 15 R 4 G 15 G 1 B 13 B 7 R 18 R 6 G 14 G 7 R 9 G 6 B 11 G 7 B 14 B 9 G 13 B 5 G 11 B 8 R 18 G 1 G 3 G 12 B 16 G 2 G 13 R 5 R 20 R 10 G 13 R 13 B 16 B 1 G 19 B 17 B 18 B 12 R 16 R 15 R 19 R
output:
262244682
result:
ok answer is '262244682'
Test #43:
score: 0
Accepted
time: 473ms
memory: 3600kb
input:
18 18 8 G 15 B 2 G 6 B 14 B 15 G 1 G 17 B 4 R 8 B 4 R 13 R 6 R 12 B 4 G 11 G 3 G 8 B 6 R 11 B 1 R 4 B 9 B 15 G 12 R 18 B 5 R 7 B 1 R 16 B 10 B 18 G 2 R 5 G 14 B 17 G
output:
41204079
result:
ok answer is '41204079'
Test #44:
score: 0
Accepted
time: 1293ms
memory: 134428kb
input:
22 24 14 R 17 R 4 G 21 R 15 R 16 R 16 R 19 B 2 R 12 R 5 B 7 R 4 B 18 B 8 B 22 R 6 B 20 R 8 B 10 B 4 R 20 B 6 R 8 B 9 R 21 B 5 R 15 G 13 R 18 B 11 R 19 B 2 B 5 G 11 R 20 R 1 B 15 G 7 G 14 G 3 G 16 G 11 B 13 R 5 G 19 R 3 B 5 R
output:
1696899432
result:
ok answer is '1696899432'
Test #45:
score: 0
Accepted
time: 542ms
memory: 3628kb
input:
19 19 14 B 16 G 5 G 14 G 2 G 19 R 13 G 16 B 1 G 19 G 1 R 12 G 3 R 8 G 7 R 11 B 2 R 7 G 6 R 11 G 6 G 9 G 7 B 8 G 9 G 10 R 7 B 15 G 6 B 15 B 5 B 18 R 14 G 15 R 5 G 9 R 7 G 11 B
output:
93857886
result:
ok answer is '93857886'
Test #46:
score: 0
Accepted
time: 944ms
memory: 134288kb
input:
22 33 6 R 19 R 5 G 7 G 2 G 10 R 2 B 4 B 11 R 14 B 1 B 2 R 6 B 16 B 8 G 20 B 9 B 20 R 7 G 12 B 15 B 21 R 18 R 19 B 14 B 15 G 9 B 15 B 2 B 13 G 9 G 21 B 3 B 16 R 5 R 19 B 5 R 15 B 11 B 15 B 5 R 14 G 5 B 12 B 5 G 17 B 4 B 18 G 4 B 11 G 12 R 16 G 3 G 8 G 4 G 12 R 5 B 10 B 15 B 21 B 1 R 17 G 4 G 6 R 5 B ...
output:
645861438
result:
ok answer is '645861438'
Test #47:
score: 0
Accepted
time: 1182ms
memory: 19520kb
input:
21 7 1 R 13 R 6 B 20 G 14 G 17 G 11 G 16 R 10 B 18 G 1 G 5 B 1 G 19 B
output:
4595429376
result:
ok answer is '4595429376'
Test #48:
score: 0
Accepted
time: 2032ms
memory: 134356kb
input:
22 1 5 R 16 R
output:
27894275208
result:
ok answer is '27894275208'
Test #49:
score: 0
Accepted
time: 322ms
memory: 3696kb
input:
18 28 4 B 15 R 9 G 13 G 1 B 18 G 3 G 17 B 4 G 18 R 2 R 9 G 2 G 7 R 7 B 14 R 10 R 13 G 4 R 7 G 1 R 8 G 1 B 11 G 1 B 9 R 7 B 11 G 1 R 4 R 8 G 11 B 6 B 17 G 1 R 2 G 16 B 18 R 6 R 18 R 6 R 10 B 1 B 14 B 12 R 18 B 2 R 10 B 14 G 17 R 1 R 17 G 1 B 5 B 11 B 12 B
output:
16261180
result:
ok answer is '16261180'
Test #50:
score: 0
Accepted
time: 1234ms
memory: 5196kb
input:
20 6 14 R 16 G 2 R 17 R 4 B 20 G 15 R 16 B 3 G 20 G 1 G 2 B
output:
1718680194
result:
ok answer is '1718680194'
Test #51:
score: 0
Accepted
time: 1472ms
memory: 134364kb
input:
22 15 10 B 22 B 5 B 7 G 2 R 5 B 4 B 5 G 6 G 17 G 14 R 16 G 3 G 9 R 6 R 15 G 2 G 5 G 11 R 17 R 16 G 20 G 17 R 18 R 16 G 20 R 3 R 21 R 4 G 15 B
output:
5320183680
result:
ok answer is '5320183680'
Test #52:
score: 0
Accepted
time: 470ms
memory: 3760kb
input:
18 22 1 B 11 R 1 R 2 R 10 G 11 B 4 G 11 R 10 B 18 G 6 R 11 R 13 B 14 B 5 R 15 R 1 G 8 G 12 B 15 R 14 B 18 R 3 B 12 G 1 G 6 B 12 R 16 R 9 R 18 G 14 R 17 G 3 B 18 B 8 R 18 R 14 G 16 G 10 R 14 R 5 B 6 B 2 B 16 B
output:
21870162
result:
ok answer is '21870162'
Test #53:
score: 0
Accepted
time: 1121ms
memory: 134272kb
input:
22 26 10 G 16 R 5 R 13 B 4 R 15 B 11 B 19 R 1 R 15 G 11 G 18 R 3 R 5 G 14 G 20 B 9 R 14 R 19 G 22 B 2 B 18 R 3 B 18 B 13 G 20 G 14 R 20 R 3 G 14 B 6 B 14 R 3 G 16 R 4 R 21 R 4 G 10 G 9 R 12 B 1 B 6 R 8 G 14 G 2 B 16 B 1 B 10 G 2 G 3 B 6 B 22 G
output:
1215125316
result:
ok answer is '1215125316'
Test #54:
score: 0
Accepted
time: 1983ms
memory: 134392kb
input:
22 7 4 G 18 G 3 B 17 G 18 G 20 G 11 B 18 R 8 G 13 G 10 B 22 G 11 R 21 R
output:
13514190336
result:
ok answer is '13514190336'
Test #55:
score: 0
Accepted
time: 456ms
memory: 3724kb
input:
19 31 1 R 12 R 3 B 10 G 2 G 18 B 7 G 17 R 7 B 19 R 9 G 14 R 1 B 17 G 10 G 11 R 3 B 16 G 14 B 18 G 1 G 16 R 14 G 16 G 5 G 18 G 10 G 14 R 2 R 7 G 5 B 11 B 3 R 6 G 5 R 7 R 9 B 11 G 1 B 5 R 4 G 19 R 10 R 16 G 16 R 17 G 5 G 19 B 7 B 8 B 5 R 6 G 12 G 15 R 12 R 17 B 5 G 16 B 8 G 10 B 5 G 15 G
output:
21281991
result:
ok answer is '21281991'
Test #56:
score: 0
Accepted
time: 529ms
memory: 5356kb
input:
20 23 4 B 18 R 9 R 19 B 6 R 10 B 15 G 18 B 4 G 10 G 16 G 19 B 9 R 16 B 7 G 19 R 2 R 14 G 1 R 8 B 5 R 9 G 7 R 18 R 11 R 20 B 5 R 20 G 10 B 12 B 3 R 7 B 8 G 15 G 8 G 16 G 7 R 13 R 13 G 19 B 8 R 9 R 4 R 7 G 5 R 14 R
output:
241127262
result:
ok answer is '241127262'
Test #57:
score: 0
Accepted
time: 1140ms
memory: 3584kb
input:
19 0
output:
1162261467
result:
ok answer is '1162261467'
Test #58:
score: 0
Accepted
time: 1647ms
memory: 134428kb
input:
22 7 11 G 13 B 4 R 13 G 12 G 21 B 1 R 10 B 19 G 21 R 12 R 16 R 9 G 15 B
output:
13094706240
result:
ok answer is '13094706240'
Test #59:
score: 0
Accepted
time: 1083ms
memory: 5344kb
input:
20 3 4 B 9 B 5 R 7 G 8 R 16 B
output:
2448880128
result:
ok answer is '2448880128'
Test #60:
score: 0
Accepted
time: 1435ms
memory: 134364kb
input:
22 22 8 R 10 B 3 B 14 B 1 R 5 B 16 B 17 G 20 G 21 R 3 R 20 G 3 B 5 B 9 G 12 G 2 G 16 G 12 R 20 B 15 R 21 B 5 B 13 G 5 G 17 R 11 B 22 G 6 G 16 R 17 G 22 G 20 B 22 R 4 R 16 G 13 B 18 R 11 G 20 G 1 R 22 B 1 B 2 B
output:
2171235456
result:
ok answer is '2171235456'
Test #61:
score: 0
Accepted
time: 1180ms
memory: 134432kb
input:
22 21 1 R 2 R 2 R 3 R 3 R 4 R 4 R 5 R 5 R 6 R 6 R 7 R 7 R 8 R 8 R 9 R 9 R 10 R 10 R 11 R 11 R 12 R 12 R 13 R 13 R 14 R 14 R 15 R 15 R 16 R 16 R 17 R 17 R 18 R 18 R 19 R 19 R 20 R 20 R 21 R 21 R 22 R
output:
4316282880
result:
ok answer is '4316282880'