QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#771979 | #8334. Gene | jr_zlw# | TL | 0ms | 61824kb | C++17 | 2.0kb | 2024-11-22 16:29:58 | 2024-11-22 16:29:58 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(a,b,c) for(int c(a);c<=(b);++c)
#define drep(a,b,c) for(int c(a);c>=(b);--c)
#define grep(b,c) for(int c(head[b]);c;c=nxt[c])
using namespace std;
inline int read()
{
int res=0;char ch=getchar();while(ch<'0'||ch>'9')ch=getchar();
while(ch<='9'&&ch>='0')res=res*10+(ch^48),ch=getchar();return res;
}
typedef unsigned long long ull;
bool f1;
int cnt[65535];
class BitSet
{
ull a[939];
public:
BitSet(){memset(a,0,sizeof(a));}
inline bool operator [](int x){return a[x>>6]>>(x&63)&1;}
inline void Xor(const BitSet &x)
{
rep(0,938,i)a[i]^=x.a[i];
}
inline int Cnt()
{
int ans=0;
rep(0,938,i)
ans+=cnt[a[i]&(65535)]+cnt[(a[i]>>16)&(65535)]
+cnt[(a[i]>>32)&(65535)]+cnt[a[i]>>48];
return ans;
}
inline void ins(int x){a[x>>6]|=(1ull<<(x&63));}
inline void clear(){memset(a,0,sizeof(a));}
inline void copy(const BitSet &x){memcpy(a,x.a,sizeof(a));}
}a[302][26],tmp[26],res;
bool f2;
int n,Q,m,K;char s[65536];
int main()
{
rep(0,65355,i)cnt[i]=__builtin_popcount(i);
n=read();Q=read();m=read();K=read();
rep(1,n,i)
{
scanf("%s",s+1);
rep(1,m,j)a[i][s[j]-'a'].ins(j);
}
while(Q--)
{
scanf("%s",s+1);int Ans=0;
rep(0,25,i)tmp[i].clear();
rep(1,m,j)
{
tmp[s[j]-'a'].ins(j);
// printf("wcnm :: tmp[%c].ins(%d)\n",s[j],j);
}
rep(1,n,i)
{
bool flag=false;int ans=0;
rep(0,25,c)
{
// printf("tmp[c] :: ");rep(1,4,q)printf("%d",tmp[c][q]);puts("");
res.copy(tmp[c]);
res.Xor(a[i][c]);
ans+=res.Cnt();
// printf("cnm :: %c %d\n",c+'a',ans);
if(ans>2*K)
{
flag=true;
break;
}
}
if(!flag)++Ans;
// printf("%d :: %d\n",i,Ans);
}
printf("%d\n",Ans);
}
return 0;
}
/*
6 4 4 1
kaki
kika
manu
nana
tepu
tero
kaka
mana
teri
anan
8 6 7 3
delphis
aduncus
peronii
plumbea
clymene
hectori
griseus
electra
delphis
helpiii
perphii
clumeee
eleelea
ddlpcus
*/
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 61824kb
input:
6 4 4 1 kaki kika manu nana tepu tero kaka mana teri anan
output:
2 2 1 0
result:
ok 4 number(s): "2 2 1 0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 61820kb
input:
8 6 7 3 delphis aduncus peronii plumbea clymene hectori griseus electra delphis helpiii perphii clumeee eleelea ddlpcus
output:
1 1 2 2 1 2
result:
ok 6 numbers
Test #3:
score: -100
Time Limit Exceeded
input:
300 300 9 10 dmzampmxe bteaudaxb fjfwhhsfq btnfzqtyp ijjrkbyht hkizlvgdc ukwsnhiff hacsdrwyl fbjabnhst ktsxbgbtg jopdbsdsr yxdxxjltd daechsouq klrglgwbn llzhqzlor ckdedutfn lkjxcryoe zvusjevtz cevrcdltg tdmmvvpkj davfsweem spcfhcitm aohsfqrqh lblehevpj soaqryimp tbxlulxmn tnlzbkhda ukfhjykuk eghpuua...