QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#664810#6611. United in StormwindDixiky_215WA 88ms132356kbC++201.8kb2024-10-21 22:29:532024-10-21 22:29:53

Judging History

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

  • [2024-10-21 22:29:53]
  • 评测
  • 测评结果:WA
  • 用时:88ms
  • 内存:132356kb
  • [2024-10-21 22:29:53]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int MAXN=(1<<21)+10;
#define ll long long
int n,m;
string bb[MAXN];
ll a[MAXN],b[MAXN],ta[MAXN],tb[MAXN],k;
ll f[MAXN],g[MAXN];
int s[MAXN];
void FWTxor(ll a[],long long type)
{
    int i,j,k,x,y;
    for(i=1;i<=m;i++)
    {
        for(j=0;j<(1<<m);j+=1<<i)
        {
            for(k=0;k<(1<<i-1);k++)
            {
                x=(a[j|k]+a[j|(1<<i-1)|k])*type;
                y=(a[j|k]-a[j|(1<<i-1)|k])*type,
                a[j|k]=x,a[j|(1<<i-1)|k]=y;
            }
        }
    }
    return;
}
void FWTxork(ll a[])
{
    int i,j,k,x,y;
    for(i=1;i<=m;i++)
    {
        for(j=0;j<(1<<m);j+=1<<i)
        {
            for(k=0;k<(1<<i-1);k++)
            {
                x=(a[j|k]+a[j|(1<<i-1)|k])/2;
                y=(a[j|k]-a[j|(1<<i-1)|k])/2,
                a[j|k]=x,a[j|(1<<i-1)|k]=y;
            }
        }
    }
    return;
}

int main()
{
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>bb[i];
        int sss=0;
        for(int j=0;j<m;j++)
        {
            if(bb[i][j]=='A') sss+=(1<<j);
        }
        s[i]=sss;
        a[sss]++;
    }
    for(int i=0;i<(1<<m);i++) b[i]=a[i];
    memcpy(ta,a,sizeof a);memcpy(tb,b,sizeof b);
    FWTxor(ta,1);FWTxor(tb,1);
    for(int i=0;i<(1<<m);i++) ta[i]=(long long) ta[i]*tb[i];
    FWTxork(ta);
    for(int i=0;i<(1<<m);i++) f[i]=ta[i];
    f[0]-=n;
    int lim=(1<<m)-1;
    for(int i=0;i<(1<<m);i++) f[i]/=2LL;
    
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<(1<<m);j++)
        {
            if(j&(1<<i)) f[j]+=f[j^(1<<i)];
        }
    }
    ll ans=0;
    for(int i=1;i<(1<<m);i++)
    {
        ll sumk=(ll) n*(ll) (n-1LL)/2LL;
        if(sumk-f[i^lim]>=k) ans++;
    }
    cout<<ans;
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 11ms
memory: 106580kb

input:

2 2 1
AA
BB

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 13ms
memory: 107400kb

input:

2 2 1
AA
AB

output:

2

result:

ok 1 number(s): "2"

Test #3:

score: 0
Accepted
time: 22ms
memory: 106520kb

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: 7ms
memory: 107324kb

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: 7ms
memory: 107452kb

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: 7ms
memory: 106864kb

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: 11ms
memory: 107156kb

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: 8ms
memory: 106836kb

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: 15ms
memory: 107696kb

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: 20ms
memory: 107224kb

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: 88ms
memory: 131868kb

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: 66ms
memory: 123900kb

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: 75ms
memory: 128400kb

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: 82ms
memory: 124844kb

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: 79ms
memory: 130132kb

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: 77ms
memory: 132216kb

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: 74ms
memory: 132144kb

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: 75ms
memory: 132356kb

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: 75ms
memory: 131188kb

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: 0
Accepted
time: 29ms
memory: 110112kb

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:

1

result:

ok 1 number(s): "1"

Test #21:

score: 0
Accepted
time: 28ms
memory: 107336kb

input:

200000 2 1
BB
BA
BB
AB
BB
BB
BA
BA
AB
BA
AB
BA
AB
AB
AA
BA
BB
AA
BA
BB
AB
AB
AB
AB
BA
BB
BA
AA
AA
AB
BB
AA
AA
BB
BB
BA
AB
AA
AB
AB
AA
AB
BA
AA
BA
AA
AB
BB
AA
BB
BB
BA
BA
BA
AB
AB
AA
BA
BB
AB
AA
BA
BA
AB
BA
BA
BA
BB
BB
BA
BA
BA
AA
AB
AB
AB
AB
BA
AB
BA
BB
AB
BB
BB
AB
BB
BB
BA
BA
BB
AB
AA
AB
AA
BB
BB
A...

output:

3

result:

ok 1 number(s): "3"

Test #22:

score: -100
Wrong Answer
time: 28ms
memory: 110056kb

input:

200000 3 14999990279
ABB
BBA
BAA
BBA
AAA
AAB
BBA
BAA
BBB
BBB
BAB
ABB
BAA
BBB
BAB
BBB
BBB
BBA
ABA
BAB
BAA
BBB
ABA
BAB
AAA
BAA
BAA
BAA
BBA
AAB
BAA
ABB
BBA
AAA
BAB
AAB
ABB
AAA
AAB
BAA
BBB
ABA
BAB
ABB
AAB
BBA
BAB
AAA
BBB
BAA
ABA
AAA
ABB
BBB
AAB
AAB
AAB
AAB
ABB
AAB
BAB
AAB
ABA
BAB
ABB
BAB
ABA
ABA
ABA
AAB...

output:

7

result:

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