QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#753548 | #6611. United in Stormwind | SGColin# | WA | 1ms | 3880kb | C++14 | 1.7kb | 2024-11-16 13:09:50 | 2024-11-16 13:09:50 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define eb emplace_back
#define all(s) (s).begin(), (s).end()
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
inline ll rd() {
ll x = 0;
bool f = 0;
char c = getchar();
for (; !isdigit(c); c = getchar()) f |= (c == '-');
for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
return f ? -x : x;
}
constexpr int N = (1 << 20);
ll cnt[N];
void FWT(ll *a, int n, int f) {
for (int k = 1; k < n; k <<= 1)
for (int i = 0; i < n; i += (k << 1))
for (int j = 0; j < k; ++j)
if (f == 1) {
ll x = a[i + j];
ll y = a[i + j + k];
a[i + j] = x + y;
a[i + j + k] = x - y;
} else {
ll x = a[i + j];
ll y = a[i + j + k];
a[i + j] = (x + y) / 2;
a[i + j + k] = (x - y) / 2;
}
}
int main() {
int n = rd(), m = rd();
ll k = rd();
rep(i, 1, n) {
char s[30];
scanf("%s", s);
int S = 0;
rep(j, 0, m - 1) if (s[j] == 'A') S += (1 << j);
++cnt[S];
}
FWT(cnt, 1 << m, 1);
rep(i, 0, (1 << m) - 1) cnt[i] = cnt[i] * cnt[i];
FWT(cnt, 1 << m, -1);
rep(i, 0, m - 1)
rep(s, 0, (1 << m) - 1)
if ((s >> i) & 1) cnt[s] += cnt[s ^ (1 << i)];
int ans = 0;
rep(t, 0, (1 << m) - 1)
if (1ll * n * n - cnt[(1 << m) - 1 - t] >= k) ++ans;
printf("%d\n", ans);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3880kb
input:
2 2 1 AA BB
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2 2 1 AA AB
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3780kb
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:
1023
result:
wrong answer 1st numbers differ - expected: '300', found: '1023'