QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#648672 | #9463. 基础 ABC 练习题 | hos_lyric# | 50 | 2636ms | 102204kb | C++14 | 7.4kb | 2024-10-17 19:55:22 | 2024-10-17 19:55:23 |
Judging History
answer
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#pragma GCC target("avx2")
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
namespace exper {
constexpr int N = 5;
int id(int x, int y) {
return x * (N + 1) + y;
}
map<string, Int> cache;
Int solve(const string &s) {
auto it = cache.find(s);
if (it != cache.end()) return it->second;
Int ret = 0;
assert((int)s.size() % 3 == 0);
const int n = s.size() / 3;
if (n == 0) {
ret |= 1LL << id(0, 0);
} else {
for (int i = 1; i < 3*n; ++i) if ((s[i] - s[0] - 1) % 3 == 0) {
for (int j = i + 1; j < 3*n; ++j) if ((s[j] - s[i] - 1) % 3 == 0) {
const Int res = solve(s.substr(1, i - 1) + s.substr(i + 1, j - (i + 1)) + s.substr(j + 1));
ret |= res << ((s[0] == 'A') ? (N + 1) : (s[0] == 'B') ? 1 : 0);
}
}
}
return ret;
}
void run() {
for (int n = 1; n <= N; ++n) {
string s = string(n, 'A') + string(n, 'B') + string(n, 'C');
do {
const Int res = solve(s);
int now[3] = {}, mxs[3] = {};
for (int i = 0; i < 3*n; ++i) {
++now[s[i] - 'A'];
chmax(mxs[0], now[0] - now[2]);
chmax(mxs[1], now[1] - now[0]);
chmax(mxs[2], now[2] - now[1]);
}
if (res) {
printf("%s %d %d %d\n", s.c_str(), mxs[0], mxs[1], mxs[2]);
for (int x = 0; x <= n; ++x) {
for (int y = 0; x + y <= n; ++y) putchar(".#"[res >> id(x, y) & 1]);
puts("");
}
assert(mxs[0] + mxs[1] + mxs[2] <= n);
for (int x = 0; x <= n; ++x) for (int y = 0; x + y <= n; ++y) {
const int z = n - x - y;
assert((bool)(res >> id(x, y) & 1) == (x >= mxs[0] && y >= mxs[1] && z >= mxs[2]));
}
} else {
assert(mxs[0] + mxs[1] + mxs[2] > n);
}
} while (next_permutation(s.begin(), s.end()));
fflush(stdout);
cerr << "DONE n = " << n << endl;
}
}
} // exper
constexpr unsigned ALL[61] = {1
,3
,48
,1077
,25950
,631596
,15361200
,373543344
,513491674
,3715046604
,2905885740
,1568880512
,2580218992
,1190440544
,717460800
,3773052672
,4125163354
,1253250684
,451796724
,588301280
,3790101036
,1976168152
,2307984512
,3414639104
,4155978864
,3748854816
,300437408
,2740636160
,342373696
,3437770880
,3706226944
,2582641664
,818675546
,4282719452
,4003661124
,2620370720
,3557104884
,1127743016
,1645938208
,544025216
,3328387628
,3785150760
,819081384
,2964923392
,755846272
,2114968832
,3614678528
,560097280
,3053794416
,804406688
,1928254944
,3311421696
,2927919008
,179566400
,4157937152
,2641385472
,2225157440
,2881464704
,3321196416
,2878195712
,2103642368
};
constexpr int MAX_N = 36;
constexpr int MAX_U = (MAX_N + 1) * (MAX_N + 2) * (MAX_N + 3) / 6;
int subtaskId;
int N;
char A[210], B[210], S[210];
int U;
int ids[MAX_N + 1][MAX_N + 1][MAX_N + 1];
int xs[MAX_U], ys[MAX_U], zs[MAX_U];
unsigned dp[2][MAX_N + 1][MAX_N + 1][MAX_U + 1];
int main() {
// exper::run();
for (int numCases; ~scanf("%d%d", &numCases, &subtaskId); ) { for (int caseId = 1; caseId <= numCases; ++caseId) {
scanf("%d", &N);
scanf("%s", A);
scanf("%s", B);
scanf("%s", S);
const int hatena = count(S, S + 3*N, '?');
if (hatena == 0) {
int now[3] = {};
int x = 0, y = 0, z = 0;
for (int i = 0; i < 3*N; ++i) {
++now[S[i] - 'A'];
chmax(x, now[0] - now[2]);
chmax(y, now[1] - now[0]);
chmax(z, now[2] - now[1]);
}
const int d = N - (x + y + z);
bool ok = false;
for (int dx = 0; dx <= d; ++dx) for (int dy = 0; dx + dy <= d; ++dy) {
ok = ok || (A[x + dx] == '1' && B[y + dy] == '1');
}
ok = ok && (now[0] == N && now[1] == N && now[2] == N);
puts(ok ? "1" : "0");
} else if (subtaskId == 3) {
printf("%u\n", ALL[N]);
} else if (N <= MAX_N) {
U = 0;
for (int x = 0; x <= N; ++x) for (int y = 0; x + y <= N; ++y) for (int z = 0; x + y + z <= N; ++z) {
const int u = ids[x][y][z] = U++;
xs[u] = x;
ys[u] = y;
zs[u] = z;
}
assert(U <= MAX_U);
for (int x = 0; x <= N; ++x) for (int y = 0; y <= N; ++y) for (int z = 0; z <= N; ++z) if (x + y + z > N) ids[x][y][z] = U;
for (int a = 0; a <= N; ++a) for (int b = 0; b <= N; ++b) memset(dp[0][a][b], 0, (U + 1) * sizeof(unsigned));
dp[0][0][0][ids[0][0][0]] = 1;
for (int i = 0; i < 3*N; ++i) {
auto crt = dp[i & 1], nxt = dp[(i + 1) & 1];
for (int a = 0; a <= N; ++a) for (int b = 0; b <= N; ++b) memset(nxt[a][b], 0, (U + 1) * sizeof(unsigned));
for (int a = 0; a <= N; ++a) for (int b = 0; b <= N; ++b) {
const int c = i - a - b;
if (c >= 0) {
const int x0 = max(a - c, 0);
const int y0 = max(b - a, 0);
const int z0 = max(c - b, 0);
for (int x = x0; x + y0 + z0 <= N; ++x) for (int y = y0; x + y + z0 <= N; ++y) for (int z = z0; x + y + z <= N; ++z) {
const int u = ids[x][y][z];
if (crt[a][b][u]) {
if (a < N && (S[i] == '?' || S[i] == 'A')) nxt[a + 1][b][(x == a-c) ? ids[a-c+1][y][z] : u] += crt[a][b][u];
if (b < N && (S[i] == '?' || S[i] == 'B')) nxt[a][b + 1][(y == b-a) ? ids[x][b-a+1][z] : u] += crt[a][b][u];
if (c < N && (S[i] == '?' || S[i] == 'C')) nxt[a][b] [(z == c-b) ? ids[x][y][c-b+1] : u] += crt[a][b][u];
}
}
}
}
}
unsigned ans = 0;
for (int x = 0; x <= N; ++x) for (int y = 0; x + y <= N; ++y) for (int z = 0; x + y + z <= N; ++z) {
const int d = N - (x + y + z);
bool ok = false;
for (int dx = 0; dx <= d; ++dx) for (int dy = 0; dx + dy <= d; ++dy) {
ok = ok || (A[x + dx] == '1' && B[y + dy] == '1');
}
if (ok) {
// cerr<<"ok "<<x<<" "<<y<<" "<<z<<": "<<dp[(3*N) & 1][N][N][ids[x][y][z]]<<endl;
ans += dp[(3*N) & 1][N][N][ids[x][y][z]];
}
}
printf("%u\n", ans);
} else {
puts("-1");
}
}
#ifndef LOCAL
break;
#endif
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 20
Accepted
Test #1:
score: 20
Accepted
time: 0ms
memory: 4020kb
input:
60 1 1 11 11 ABC 2 111 111 CABABC 3 1111 1111 CAABBCBAC 4 11111 11111 BACBBACBACAC 5 111111 111111 CABCCBBAABCCBAA 6 1111111 1111111 ABABABCACBCBCCACBA 7 11111111 11111111 BCAABACBBCBBABCCAACAC 8 111111111 111111111 CCBCBBBCAABCBCAAAAACBCBA 9 1111111111 1111111111 CCCCACABCBABAABCCAABABBCBBA 10 1111...
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
result:
ok Accepted!!!
Test #2:
score: 20
Accepted
time: 0ms
memory: 3792kb
input:
60 1 1 11 11 CBA 2 111 111 BACACB 3 1111 1111 BCBCACABA 4 11111 11111 CCBACABBBCAA 5 111111 111111 BCACBBABBCCAACA 6 1111111 1111111 BBCBACCAACBCBCAABA 7 11111111 11111111 ACBCCBBAABAABCACCACBB 8 111111111 111111111 BAACACBACCCBAACCBABABBCB 9 1111111111 1111111111 BABCBCAAAAABBCCCACBCBBABACC 10 1111...
output:
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 Accepted!!!
Test #3:
score: 20
Accepted
time: 0ms
memory: 3716kb
input:
60 1 1 11 11 BCA 2 111 111 BCABCA 3 1111 1111 CBACCAABB 4 11111 11111 BACBCBBCCAAA 5 111111 111111 BCCCBABACCBABAA 6 1111111 1111111 ACAACBABABBCACBCCB 7 11111111 11111111 BBBCABCCCAABCACBACAAB 8 111111111 111111111 ACCACAABACBAABBCBCBBACBC 9 1111111111 1111111111 BCCBACBBACCCBCCAABAACABAABB 10 1111...
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
result:
ok Accepted!!!
Test #4:
score: 20
Accepted
time: 0ms
memory: 3736kb
input:
60 1 1 11 11 BCA 2 111 111 ACABCB 3 1111 1111 BABCABCCA 4 11111 11111 CCABACABBACB 5 111111 111111 ABBBCBBCACCAACA 6 1111111 1111111 CACBABCABCCBABAACB 7 11111111 11111111 BACBCABACBBCCCBAAACAB 8 111111111 111111111 CABABBCAACABCBACBABACBCC 9 1111111111 1111111111 BCBAACBABABCBACBABABCCACACC 10 1111...
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
result:
ok Accepted!!!
Test #5:
score: 20
Accepted
time: 0ms
memory: 4012kb
input:
60 1 1 11 11 ABC 2 111 111 BBCACA 3 1111 1111 ACBBCBAAC 4 11111 11111 ABACACCCABBB 5 111111 111111 ACCCCCAAABABBBB 6 1111111 1111111 ABAABBBBCCCCCCAABA 7 11111111 11111111 ACBBBACCCCCCAABABBBAA 8 111111111 111111111 CAAABAAACCCCBBCBBBCACBAB 9 1111111111 1111111111 ABAAACBBCCCCCCCBAAABAACBBBB 10 1111...
output:
1 1 0 0 0 1 1 0 1 1 1 1 1 0 1 1 1 0 0 0 0 1 1 1 0 1 1 1 1 1 0 0 1 0 1 0 1 0 0 0 1 0 0 0 1 1 0 1 0 0 1 0 1 0 1 0 0 0 1 0
result:
ok Accepted!!!
Test #6:
score: 20
Accepted
time: 0ms
memory: 3988kb
input:
60 1 1 11 11 BCA 2 111 111 ACCBAB 3 1111 1111 BACCACBBA 4 11111 11111 AAABBCBCBACC 5 111111 111111 AABBBBCCBCCAACA 6 1111111 1111111 AAACCBCCCAABACBBBB 7 11111111 11111111 AAACACCACBBAABBCBCCBB 8 111111111 111111111 AAACAAABBBBBBBCBACCCACCC 9 1111111111 1111111111 BBCCACCCACCACCBAABBAAAABBBB 10 1111...
output:
1 0 0 1 1 0 1 1 1 1 1 0 0 0 1 1 1 0 0 1 0 1 1 1 1 1 1 0 1 1 1 1 1 0 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 1 1 1 0 1
result:
ok Accepted!!!
Test #7:
score: 20
Accepted
time: 0ms
memory: 3716kb
input:
60 1 1 11 11 BCA 2 111 111 ACCABB 3 1111 1111 CAABBBCAC 4 11111 11111 BBCCBCCABAAA 5 111111 111111 BAABBBCCCCCAABA 6 1111111 1111111 AACACCCCBABBBCAABB 7 11111111 11111111 AACBBCBBBCCCCCAAABBAA 8 111111111 111111111 AAAABBCBBBBCBBCCCCCCAAAA 9 1111111111 1111111111 ABBBBBBBBCCBCAACCACAACCAAAC 10 1111...
output:
1 0 1 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 1 0 1 1 0 1 1 0 0 0 0 1 1 0 0 1 0 1 1 1 0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 0 1 0 1 1
result:
ok Accepted!!!
Test #8:
score: 20
Accepted
time: 0ms
memory: 4012kb
input:
60 1 1 11 11 ABC 2 111 111 AABCBC 3 1111 1111 ABAACBBCC 4 11111 11111 AABCCBBBCACA 5 111111 111111 AAACCABBBACBCCB 6 1111111 1111111 AABBBBBBCCACAACACC 7 11111111 11111111 AAAABBBBBBCCACCCCCBAA 8 111111111 111111111 ACCBABBABBBBBCCCACCCAAAA 9 1111111111 1111111111 BAAAABCCCCCCCBBAABAACABCBBB 10 1111...
output:
1 1 1 0 1 1 1 1 0 1 0 1 1 1 0 1 1 1 0 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1 1 1 0 1 1 0
result:
ok Accepted!!!
Test #9:
score: 20
Accepted
time: 0ms
memory: 3736kb
input:
60 1 1 11 11 CAB 2 111 111 CCAABB 3 1111 1111 ACCCABBAB 4 11111 11111 AAABBBBCCACC 5 111111 111111 BCACCCCBAAAABBB 6 1111111 1111111 CAAACABABACCCBCBBB 7 11111111 11111111 ACAAACBCCCCBCAABBABBB 8 111111111 111111111 ACCAACACCCCCABABAABBBBBB 9 1111111111 1111111111 AACAAAAAACBCCBCBACBBBBBBCCC 10 1111...
output:
1 1 0 1 1 0 0 0 0 1 1 0 0 1 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 0 0 0 1 0 0 1 0 1 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1
result:
ok Accepted!!!
Test #10:
score: 20
Accepted
time: 0ms
memory: 4016kb
input:
60 1 1 11 11 BCA 2 111 111 ACACBB 3 1111 1111 AABCCCABB 4 11111 11111 CBCCCABABABA 5 111111 111111 ACACCCAABBCBABB 6 1111111 1111111 BACAAAACCBABCBCBCB 7 11111111 11111111 AAAAABBBBCCBBCCCCACAB 8 111111111 111111111 AACCCCCCABAAACAABCBBBBBB 9 1111111111 1111111111 AABAAAABCCCCABCCCABBCCABBBB 10 1111...
output:
1 0 0 1 1 0 1 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 0 0 1 0 0 0 0 1 1 1 0 0 0 0 1 0 1 1 0 1 1
result:
ok Accepted!!!
Test #11:
score: 20
Accepted
time: 0ms
memory: 3984kb
input:
60 1 1 11 11 BCA 2 111 111 CBBCAA 3 1111 1111 AABABCCCB 4 11111 11111 BABCBBCAAACC 5 111111 111111 AAACBBBBBCAACCC 6 1111111 1111111 BBBBBCCCCCCAABAAAA 7 11111111 11111111 BAAAABAACCCABBCCBBBCC 8 111111111 111111111 ABABBBBBCBCCCACCCCAAABAA 9 1111111111 1111111111 AAAABBAABCABACCCACCCBBCBCBB 10 1111...
output:
1 0 0 0 0 1 0 1 0 0 1 0 1 0 1 1 1 0 1 0 0 0 1 1 1 1 0 1 1 0 1 0 0 0 0 1 0 1 0 0 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1
result:
ok Accepted!!!
Subtask #2:
score: 20
Accepted
Dependency #1:
100%
Accepted
Test #12:
score: 20
Accepted
time: 0ms
memory: 3716kb
input:
60 2 1 01 11 ABC 2 101 001 ACBABC 3 0011 1000 AAACBBCBC 4 11100 00100 BACABCABACBC 5 001101 110010 ACBABCCABBCCAAB 6 0101010 1000011 CABBAAACACBBCCABCB 7 10010111 10100111 CABAAACBBAACBCACBBBCC 8 100101000 100000110 BACBCACBBAABCCCABCBAACBA 9 1100010100 0111110011 CAABCBBABCACBCACABCABAACBBC 10 0001...
output:
1 0 0 1 1 0 1 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 Accepted!!!
Test #13:
score: 20
Accepted
time: 0ms
memory: 3792kb
input:
60 2 1 01 01 CAB 2 011 101 ABCCBA 3 1111 0000 CBBAACCBA 4 00011 10011 BCCBCCABABAA 5 011111 111011 ACBBABCBCCAACBA 6 1011101 1101000 CBABBCACBAABABCACC 7 00001111 11010100 BCACAABCBBBCCABABCACA 8 110110100 010010100 ABAABCABCABAACCCCBBBBCCA 9 0000111111 1011100011 BAAABBCCABBBBCABACBACACCACC 10 0011...
output:
0 0 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 Accepted!!!
Test #14:
score: 20
Accepted
time: 0ms
memory: 4016kb
input:
60 2 1 01 00 ABC 2 111 000 CAABBC 3 0101 0011 CAACBCBAB 4 11011 01001 CABBCAACBBCA 5 000010 010100 BCCCACAAACBBBBA 6 0011011 0011000 BCACCBAAAAABCBCBBC 7 11000001 11111111 AACBCABACCBBCABCCBAAB 8 111010100 111101010 CBABCACBABAACBABCCCBCAAB 9 1001111111 1011000111 CAABCACCABBBABBCACCABBCAACB 10 0011...
output:
0 0 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 Accepted!!!
Test #15:
score: 20
Accepted
time: 0ms
memory: 3732kb
input:
60 2 1 00 10 BCA 2 110 000 BCAABC 3 0111 1001 CACAABBBC 4 10101 00000 ACCBCAABBACB 5 010001 100001 BBCBBAACCBACACA 6 0100101 0100010 CCAAAABCCAABBCBBBC 7 10010000 10010011 BCBCACBCBAAAABCABBCCA 8 001101111 110010111 CABACABCACBBABCBCABACABC 9 1000111100 1011101001 ACBCABABBCCBABCCAAACBBBACAC 10 1111...
output:
0 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 Accepted!!!
Test #16:
score: 20
Accepted
time: 0ms
memory: 3736kb
input:
60 2 1 10 11 CAB 2 110 100 AABBCC 3 0100 0110 CAABCBABC 4 01010 01000 BCBCABACBCAA 5 001110 100000 AAABBCCCABCBABC 6 1000000 1101100 ACCBACBCAABCAABBCB 7 11011110 01000000 AAAAABABBBCBBBACCCCCC 8 101000000 010000000 ACBABBCCCCCCCABAAABAABBB 9 1000000000 1000000000 CCCCCCCCCAABAAABABBBABBAABB 10 0111...
output:
1 0 1 0 1 0 1 1 1 1 1 1 1 1 0 0 1 0 1 1 1 1 1 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 1 1 1 1 1
result:
ok Accepted!!!
Test #17:
score: 20
Accepted
time: 0ms
memory: 3712kb
input:
60 2 1 01 10 ABC 2 100 100 BCABCA 3 1000 1100 CABACCBAB 4 11001 10000 AABCBACABBCC 5 110000 101110 BACBCAABCABCBCA 6 1110000 1111100 AABBBBCABCCCCABAAC 7 10110000 11100000 AAACCABBCAABCBBABBCCC 8 001111100 011000000 ABAACAAAACABCBCBBBBBCCCC 9 0110000000 1111000000 AACBBACBBBCBCABACACBCAABCCA 10 1111...
output:
1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 1 0 0 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 0 0 0
result:
ok Accepted!!!
Test #18:
score: 20
Accepted
time: 1ms
memory: 4016kb
input:
60 2 1 10 11 ABC 2 100 100 CABCAB 3 1000 1000 CCABCABAB 4 11100 10000 ACACBABCABCB 5 111101 100000 AABCABCBACABBCC 6 1000000 0100000 BCACCCCCABAAABBBBA 7 10101110 11000000 AAABBCBBCACCCABBAACBC 8 111110000 001100000 ACBBCBBCABACCACBBABAACCA 9 1110000000 1111110000 CAAACBCCBBAAABCCBACABACCBBB 10 1100...
output:
0 1 1 1 1 1 1 1 1 0 0 1 1 0 1 0 0 1 0 1 0 0 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 0 0 1 1 1 1 1 0 0 1 0 1
result:
ok Accepted!!!
Test #19:
score: 20
Accepted
time: 0ms
memory: 4016kb
input:
60 2 1 11 10 ABC 2 100 110 BCABCA 3 1000 1111 BBCBACCAA 4 10000 10011 BCABCABCABCA 5 011111 100000 AABCBCABACABCBC 6 1110000 1000000 CAAACCCBBBCAACABBB 7 10000000 01000000 ABBCACCCABBACABACBBAC 8 110100011 100000000 AABBCABCCAABBCABCABCABCC 9 1111011100 1100000000 AAACABBBBBCACABCCBABCACBCCA 10 0111...
output:
1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 0 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 0 0 1 1 1 1 0 1 0 0 1
result:
ok Accepted!!!
Test #20:
score: 20
Accepted
time: 0ms
memory: 3792kb
input:
60 2 1 10 10 CAB 2 110 100 ABCACB 3 1000 1000 CABCABCAB 4 10111 10000 CABCABCABCAB 5 100000 110000 BCCAABCBCABACAB 6 1000000 1111000 CCCABACAABBCABCABB 7 10000000 11000110 BBCBBBCCACCCBABAAACAA 8 110000000 100000000 AACBCABCABBACCABCBCAABBC 9 1000000000 1100000000 BBCCACACCCBBACBCCABABAAAABB 10 1111...
output:
1 1 1 1 1 1 1 0 0 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 0 0 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 0
result:
ok Accepted!!!
Test #21:
score: 20
Accepted
time: 1ms
memory: 3984kb
input:
60 2 1 10 10 CAB 2 110 100 CABCAB 3 0111 1000 CABCABCAB 4 11010 11000 AAABBBCBACCC 5 110000 100000 ACBACABCBABCABC 6 1111000 1111000 AAABBBBBCACCCAABCC 7 11011100 01000000 AAAAACCBCBCBBBCACACBB 8 111000000 111010000 AAABBBBBCCCCCCCABACABABA 9 1011100010 1000000000 AAABAABAABBABBCCCCBCCCCBACB 10 1111...
output:
1 1 1 1 1 1 0 0 1 0 1 0 1 1 1 1 0 1 1 1 0 0 1 1 1 1 0 0 1 1 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 0 0 1
result:
ok Accepted!!!
Subtask #3:
score: 10
Accepted
Test #22:
score: 10
Accepted
time: 0ms
memory: 3800kb
input:
60 3 1 11 11 ??? 2 111 111 ?????? 3 1111 1111 ????????? 4 11111 11111 ???????????? 5 111111 111111 ??????????????? 6 1111111 1111111 ?????????????????? 7 11111111 11111111 ????????????????????? 8 111111111 111111111 ???????????????????????? 9 1111111111 1111111111 ??????????????????????????? 10 1111...
output:
3 48 1077 25950 631596 15361200 373543344 513491674 3715046604 2905885740 1568880512 2580218992 1190440544 717460800 3773052672 4125163354 1253250684 451796724 588301280 3790101036 1976168152 2307984512 3414639104 4155978864 3748854816 300437408 2740636160 342373696 3437770880 3706226944 2582641664 ...
result:
ok Accepted!!!
Subtask #4:
score: 0
Time Limit Exceeded
Dependency #1:
100%
Accepted
Dependency #3:
100%
Accepted
Test #23:
score: 15.2
Acceptable Answer
time: 2613ms
memory: 101904kb
input:
60 4 1 11 11 AC? 2 111 111 ?ACAAA 3 1111 1111 AA?A?CCCC 4 11111 11111 ??BBB?CBBACA 5 111111 111111 ?CC?CCCAA?BCB?? 6 1111111 1111111 ?B?BBCCABBCBA?A?BC 7 11111111 11111111 AAA?B??C?CBABACCCA?AA 8 111111111 111111111 CBBB?AAC?B?A???BABAC?ACB 9 1111111111 1111111111 A?A?BAA?BCBC??ABBBBAAA?ACBB 10 1111...
output:
0 0 0 0 0 0 0 105 1 3146 4154 3960 1260 4200 45045 0 0 0 2042040 168168 34320 2454021525 45045 180180 4157010 2042040 1058148 818007190 67863915 34918884 2898489116 1338557220 0 1963217256 27457584 4069184284 -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:
points 0.76 the max n you choose to answer is 36
Test #24:
score: 15.2
Acceptable Answer
time: 2636ms
memory: 102204kb
input:
60 4 1 11 11 CCA 2 111 111 BBAABC 3 1111 1111 ?BACB?B?B 4 11111 11111 B??ACBBCBBA? 5 111111 111111 ABBBBC?CABCABA? 6 1111111 1111111 ?ACAB?CAA?AB?C?AAC 7 11111111 11111111 ?BAAA?BCAAA??AB?BABAC 8 111111111 111111111 BCBCC?ACACA?AAAC??BACACA 9 1111111111 1111111111 ACCCBCBAA?BABBA??BBBBACAA?A 10 1111...
output:
0 0 0 0 0 0 0 0 1 0 252 0 0 84 280 462 0 25740 2860 25740 120120 27713400 12 1750320 3527160 5697720 1963217256 2496144 4620 2912596129 132526224 102965940 0 4069113896 7759752 2856441824 -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:
points 0.76 the max n you choose to answer is 36
Test #25:
score: 15.2
Acceptable Answer
time: 2592ms
memory: 102204kb
input:
60 4 1 11 11 A?B 2 111 111 BABBBB 3 1111 1111 ?ABBABBCC 4 11111 11111 CBABBBCBABAB 5 111111 111111 AABCBA?CBBCCBBA 6 1111111 1111111 AB????CCBCC?BCBBB? 7 11111111 11111111 C?BBBC?BABCC?CC?A?BAC 8 111111111 111111111 CCAAACA?C?A??AAAABC?CAC? 9 1111111111 1111111111 BAABBBCA?A?BA?CA??CAAABBBAB 10 1111...
output:
0 0 0 0 0 0 5 0 0 0 0 0 0 6930 4620 0 630 10010 225225 48048 11639628 0 99768240 30940 1681680 646646 1594684472 0 0 14725136 853572720 2205994000 3304465876 1634537160 0 3774734912 -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:
points 0.76 the max n you choose to answer is 36
Test #26:
score: 0
Time Limit Exceeded
input:
60 4 1 11 11 ??? 2 111 111 ???C?? 3 1111 1111 ????????? 4 11111 11111 ?C???????AAA 5 111111 111111 ??????????????? 6 1111111 1111111 ?????B???C?A?B?BC? 7 11111111 11111111 ??????B??????A????C?? 8 111111111 111111111 ???????????C?CB????????? 9 1111111111 1111111111 ??????B??CC?????B??C??????? 10 1111...
output:
result:
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
0%