QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#621682#6611. United in StormwindstavageWA 89ms44280kbC++202.3kb2024-10-08 16:12:412024-10-08 16:12:41

Judging History

你现在查看的是最新测评结果

  • [2024-10-08 16:12:41]
  • 评测
  • 测评结果:WA
  • 用时:89ms
  • 内存:44280kb
  • [2024-10-08 16:12:41]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define int LL
const int N = 5e6 + 7;
const int p = 998244353;
void add(int &x, int y)
{
    (x += y) >= p && (x -= p);
}
void sub(int &x, int y)
{
    (x -= y) >= p && (x += p);
}
struct FWT {
    int extend(int n)
    {
        int N = 1;
        for (; N < n; N <<= 1);
        return N;
    }
    void FWTxor(vector<int> &a, bool rev)
    {
        int n = a.size(), inv2 = (p + 1) >> 1;
        for (int l = 2, m = 1; l <= n; l <<= 1, m <<= 1) {
            for (int j = 0; j < n; j += l) {
                for (int i = 0; i < m; i++) {
                    int x = a[i + j], y = a[i + j + m];
                    if (!rev) {
                        a[i + j] = (x + y) % p;
                        a[i + j + m] = (x - y + p) % p;
                    }
                    else {
                        a[i + j] = 1LL * (x + y) * inv2 % p;
                        a[i + j + m] = 1LL * (x - y + p) * inv2 % p;
                    }
                }
            }
        }
    }
    vector<int> Xor(vector<int> a1, vector<int> a2)
    {
        int n = max(a1.size(), a2.size()), N = extend(n);
        a1.resize(N), a2.resize(N);
        FWTxor(a1, 0), FWTxor(a2, 0);
        vector<int> A(N);
        for (int i = 0; i < N; i++) A[i] = 1LL * a1[i] * a2[i] % p;
        FWTxor(A, 1);
        return A;
    }
} fwt;
int n, m, k;
void solve()
{
    vector<int> f((1 << 20));
    vector<int> res((1 << 20));
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) {
        string x;
        cin >> x;
        int s = 0;
        for (int j = 0; j < x.length(); j++) {
            if (x[j] == 'A') {
                s |= (1 << j);
            }
        }
        f[s] += 1;
    }
    vector<int> g = fwt.Xor(f, f);
    for (int i = 0; i < (1 << m);i++) {
        res[i] = g[i] / 2;
    }
    for (int j = 0; j < m;j++) {
        for (int i = 0; i < (1 << m);i++) {
            if(i>>j&1) {
                res[i] += res[i ^ (1 << j)];
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < (1 << m);i++) {
        if (n * n - res[i] * 2 >= k * 2) ans++;
    }
    cout << ans << endl;
}
signed main()
{
    cin.tie(nullptr)->sync_with_stdio(false);
    int _ = 1;
    while (_--) {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 69ms
memory: 44004kb

input:

2 2 1
AA
BB

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 67ms
memory: 44096kb

input:

2 2 1
AA
AB

output:

2

result:

ok 1 number(s): "2"

Test #3:

score: 0
Accepted
time: 66ms
memory: 44016kb

input:

5000 10 12302135
AABAAAABBA
AAABAABBAB
BAABABAAAB
ABBAABBBBA
BAAAAABAAB
BABBAAAAAA
BABBABABAB
BBABBAAAAB
BABBABBBBA
AAAAAAABAA
BBBBBAABBA
BAABABBAAB
BABAAABAAA
AAAAABAABB
BBABAABABB
ABAABBABBA
BBBAAABABA
BAAABABBAB
ABAAAAABAA
AABBBBBBAA
ABBABBABBA
AABBBABBAB
BAABBAAABB
BAAABBBBBB
ABABBAABBB
BABBABBA...

output:

300

result:

ok 1 number(s): "300"

Test #4:

score: 0
Accepted
time: 63ms
memory: 44232kb

input:

5000 10 1
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABBAABBBB
AABB...

output:

0

result:

ok 1 number(s): "0"

Test #5:

score: 0
Accepted
time: 62ms
memory: 44016kb

input:

5000 10 8968133
BABAAAAAAA
BABAAAAAAA
AAABAAAAAA
BABBBBBAAA
AABBAAABAA
AAABAAAAAA
ABAAABAAAB
BABBBBBAAA
BABAAAAAAA
BABBBBBAAA
ABAAABAAAB
BABAAAAAAA
ABAAABAAAB
AABBAAABAA
AAABAAAAAA
BABAAAAAAA
AAABAAAAAA
BABBBBBAAA
BABBBBBAAA
BABAAAAAAA
BABAAAAAAA
AABBAAABAA
AABBAAABAA
AAABAAAAAA
AAABAAAAAA
AAABAAAAA...

output:

886

result:

ok 1 number(s): "886"

Test #6:

score: 0
Accepted
time: 70ms
memory: 44060kb

input:

5000 10 10507302
BBBAABAAAB
BBBAABAAAB
ABAABAAAAA
BBBABBAAAA
ABBABABBAB
ABBABABBAB
BBBABBAAAA
BBBABBAAAA
AABAABBABA
ABBABAAABB
ABBABAAABB
ABAABAAAAA
BBABBABBAB
BAABBAABAA
BAABBBAAAA
BABBBABAAB
ABBABAAABB
BAABBAABAA
BBABBABBAB
BBABBABBAB
ABAABAAAAA
ABBABABBAB
ABAABAAAAA
ABBABAAABB
AABAABBABA
BBABBABB...

output:

755

result:

ok 1 number(s): "755"

Test #7:

score: 0
Accepted
time: 66ms
memory: 44096kb

input:

5000 10 10810288
BBBAAABBBB
BBBBBAAAAB
BBBABAABBB
BBBBABBBBA
BBBBABBBBA
AAAAAABAAA
BBAAABBABB
AAABBABAAB
AAABBBAABB
ABBBBBABBA
ABABABBBBA
AABBABBBAA
AAABAABBAB
BBBAABBBAA
AAABAABBAA
BBAABBBAAA
ABBAABABBB
BBAABBBAAA
BAABBBBABA
BBBBBABABA
AABABABAAA
BABBBBBAAB
BBABBABAAB
AAABAABBAA
BBBBABBBBA
AAABAAAB...

output:

870

result:

ok 1 number(s): "870"

Test #8:

score: 0
Accepted
time: 67ms
memory: 44088kb

input:

5000 10 12280385
ABABAAABBA
ABBBBABBAB
AABBBBAABA
BBBABAABAA
AAAAABABAA
BBBBABAAAA
BBAAAABBBA
ABABBABAAB
ABABAABBAB
BAAABAAAAB
AAAABBBABA
BABBBAABAA
ABBBBBBAAB
ABBBABBABA
BBAABAABAA
ABABBBAABB
ABBBBBAAAB
BBBAABBAAB
BBBBBAABBB
BBBABAABAB
ABAAAAABBB
AAAAABABAA
BBAAAAABBA
BAAABBABAB
BABBBBBABA
ABAAABAB...

output:

141

result:

ok 1 number(s): "141"

Test #9:

score: 0
Accepted
time: 62ms
memory: 44272kb

input:

5000 10 12436636
ABABABAABB
ABAABAAABA
BBBBAAABAB
BABAAABAAB
BBABABAABB
ABAABAAABB
ABBAAAABAB
BAAAABBBBB
ABABAAAABB
BAABAAABBA
AAAAAAABAA
BAAABBABAB
BAAABBBABA
AAAABBBBAA
AABBBAABBA
BBBAAAABAB
BBBBAABBBB
AABABBBBBA
ABABBBAABB
BBAABBABBA
ABAABABABA
BBBBAAABAB
BBBBBAAAAA
AAABABAAAB
ABABAAAAAA
AABBABAB...

output:

28

result:

ok 1 number(s): "28"

Test #10:

score: 0
Accepted
time: 68ms
memory: 44140kb

input:

5000 10 9373047
ABABAAABBB
BABBAABABB
ABABAAAAAB
ABBBAAAABA
ABBBAABABB
AABBBBBABB
AAABAAABAB
ABAABBBBAB
ABAAAABAAB
BBABBBBBAA
AABAAAAABB
BAAAAAAABA
BAABBABBBB
BABAABABBB
ABBBAABABB
ABBAAAAABB
BABBBABBAB
ABAAABABAB
AABBBABAAA
AAABAAAAAB
AABBAABABB
BBBBAAAAAB
AAABBAABBA
ABABABABBB
AABBBBBBAB
AAABAAABB...

output:

999

result:

ok 1 number(s): "999"

Test #11:

score: 0
Accepted
time: 79ms
memory: 44092kb

input:

5000 20 12473302
AAAABBABAABBBABABBAB
ABAABAAAABAABBABBABA
ABBBAABABABABBBAAAAB
BBABABBBAAAAAAABABAA
BAABBBBAABBBBABABBBB
BABBBABBBAAABABAAABB
BAAAABAABBABAABBABBA
ABBAABAAABABABBABBBA
AABAABABAABAABAABBBA
BBBABABAABBAABAAAABA
BBBBBABAAABBBBBABBBB
BBAAAAAAAAABBABBBABA
ABBAAAABABAAAAABBBBB
BBAABBABAB...

output:

635417

result:

ok 1 number(s): "635417"

Test #12:

score: 0
Accepted
time: 86ms
memory: 44000kb

input:

5000 20 1
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBBBAA
AAABABAABABBAABBB...

output:

0

result:

ok 1 number(s): "0"

Test #13:

score: 0
Accepted
time: 83ms
memory: 44056kb

input:

5000 20 9998760
ABABBAABBBABAAAABBAB
BBBABAABAABAAABAAAAA
BBBABAABAABAAABAAAAA
ABAAAAAAABAABAAABAAB
BBBABAABAABAAABAAAAA
ABAAAAAAABAABAAABAAB
BBBABAABAABAAABAAAAA
ABAAAAAAABAABAAABAAB
BBBABAABAABAAABAAAAA
BBBABAABAABAAABAAAAA
ABABBAABBBABAAAABBAB
ABBBBABBBAAAAAAAAABA
ABBBBABBBAAAAAAAAABA
BBBABAABAAB...

output:

1023376

result:

ok 1 number(s): "1023376"

Test #14:

score: 0
Accepted
time: 80ms
memory: 44224kb

input:

5000 20 11247826
BBAAABBABBABAABABAAA
BAABABBAABBBBAAAABBA
AAAAABABAAABAABAABBA
BBBBBABAAABABBBBAAAA
BBBBBABBBABABABBBABA
BBBBBABBBABABABBBABA
BABBAAABBBBAABABAABA
AABBAAABABABAABBBBBA
BBAAABBABBABAABABAAA
BBBABBBAABABBBAAAABB
BAABABAAAABBBABBBBAA
BBBABBBAABABBBAAAABB
BAABABBAABBBBAAAABBA
AABBAAABAB...

output:

929006

result:

ok 1 number(s): "929006"

Test #15:

score: 0
Accepted
time: 82ms
memory: 44036kb

input:

5000 20 12248582
ABABABABABBBAABAAABA
BBBABABABBABBBBBAABA
BAAAAAAABABBBBBBBABB
BAAABAAAAAAAABAABABB
BAABBBAABBABABBBBAAB
BBAABABBBAABBBAAABAA
BABABBABABBBABABABAB
BBBBABBBBAABABBAAAAA
ABBBBBBBBABBABBBBAAB
AABBBBBABBBABBBAAAAA
ABABAAABABBBAABAABBA
BBABABAAABBABAAABABA
BBBBBAABBABBBBBBAAAB
AAABAAABBA...

output:

342770

result:

ok 1 number(s): "342770"

Test #16:

score: 0
Accepted
time: 78ms
memory: 44280kb

input:

5000 20 12315136
ABBBABABBABBAABBBAAA
BAAAABAABAABAABBABAA
BBBABBBBABBBBABBBBAB
AAABAABBAAAABBAAABAB
AABBABBBBAAAABABAAAA
BBABBBBAAABBBBAAABBB
ABAAABAABAAAABABBBAA
BABBBBBABABAAABAABAB
AAABAABABBABBAAAAAAB
ABABBABBAABBBAAABABA
BAABBAAABBBAABABBBAA
BAABBBAAAAAABABBBAAB
AAABABBAAABABBBABBBA
AAABAABBAA...

output:

891051

result:

ok 1 number(s): "891051"

Test #17:

score: 0
Accepted
time: 86ms
memory: 44280kb

input:

5000 20 12460867
AABBABBAAABABABABABA
ABAABBBABAAAABAABABB
ABAABAAABAABABAABAAA
AABABBABBAABABBAABBB
BAABBAABABBABBABBBBA
BBBABABAAABBBAABBABA
BABABBAABBABAAAABABB
BABBBABBBBAABAABBABA
BABABBABAAABBAABABAA
AABAABBBABBAABBABABB
AABBBABBBBABABBAAAAA
BBBBBABBBABBBBBAABBA
ABABAABBAAAAAABAAABB
AABBBABAAA...

output:

487621

result:

ok 1 number(s): "487621"

Test #18:

score: 0
Accepted
time: 89ms
memory: 44024kb

input:

5000 20 12482845
BBBBAABABBBAAAAAABBA
BBBAAAABBABBABBAABAA
BABABBBBBAAAAABBBAAB
AABAAABABAAABBAAABAA
AAAAABAABAAABBAAABBA
ABBBAAABAAAAAAAAAAAB
ABABBABABABBBAAAAAAB
BBABBABABBBAABBBABBA
BBAAABBAAABABBBBAABB
ABBAABABAABBAABABABA
BBBAABABABBBBBABAABA
AABAAAAAAAAABAAABBBA
BAAAABABBBABAAAABABA
BAAAAABBBA...

output:

148743

result:

ok 1 number(s): "148743"

Test #19:

score: 0
Accepted
time: 85ms
memory: 44072kb

input:

5000 20 12302677
BBAABBBAAAAABAAAAAAB
AABBBAAAAABAAABBAAAB
AABABAABBBAAAABAAABB
BBBBBABAABAAAAAABBBA
AABBAAAAABBAABABABBB
BBAABAAABABBBBBAABAB
BBAAABAAABBBBBAABBBA
BBABBAABAABBABBABBAA
ABABBABABBBAAABBBBBB
BAABBAABBBAABBBAAABB
ABBBBAABBABBBAAABBBA
AAABABAAAAAAABBBAABB
AAAABBBBAABBBBABBBAA
AAABBBAAAA...

output:

993237

result:

ok 1 number(s): "993237"

Test #20:

score: -100
Wrong Answer
time: 78ms
memory: 44032kb

input:

200000 1 9999998911
A
B
B
A
B
B
A
A
A
B
B
B
B
B
A
B
B
A
B
B
A
A
A
A
B
B
A
A
A
B
A
B
B
A
A
B
B
B
A
A
A
B
A
A
A
B
A
A
B
A
B
B
B
A
A
B
B
B
A
B
B
A
A
B
B
A
B
B
B
A
A
B
B
A
B
A
A
B
A
A
A
B
A
B
B
B
A
B
A
B
B
B
B
A
A
B
A
B
B
B
A
B
A
A
B
B
B
B
B
A
A
B
B
A
A
B
A
B
A
B
A
B
B
A
B
B
A
A
B
B
B
A
B
A
A
B
B
B
B
B
...

output:

2

result:

wrong answer 1st numbers differ - expected: '1', found: '2'