QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#765702#8334. GenexxTL 10ms3856kbC++202.4kb2024-11-20 15:02:052024-11-20 15:02:06

Judging History

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

  • [2024-11-20 15:02:06]
  • 评测
  • 测评结果:TL
  • 用时:10ms
  • 内存:3856kb
  • [2024-11-20 15:02:05]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define ll long long
#define yes cout<<"Yes\n";
#define no cout<<"No\n";
#define ok cout<<"OK\n";
#define pii pair<int,int>
#define endl "\n"
typedef long long LL;
using namespace std;
// const int N=5e5+10;
// int mod=1e9+7;
// int p[N];
// int a[N];
// struct node {
//     int l,r,mn,mx,res;
// }tr[N*4];
// int find(int x) {
//     if(x==p[x])return  x;
//     return p[x]=find(p[x]);
// }
// void js(int p,int l,int r) {
//     tr[p]={l,r};
//     if(l==r) {
//         tr[p].mn=tr[p].res=tr[p].mx=a[l];
//         return;
//     }
//     int mid=(l+r)/2;
//     js(p,l,mid);
//     js(p,mid+1,r);
//     tr[p].mn=min(tr[p*2].mn,tr[p*2+1].mn);
//     tr[p].mx=max(tr[p*2].mx,tr[p*2+1].mx);
// }
// int findmn(int p,int l,int r,int pl,int pr) {
//     if(pl<=r&&r<=pr) {
//             return tr[p].mn;
//     }
//     int mid=(l+r)/2;
//     if(pr<=mid)return  findmn(p,l,mid,pl,pr);
//     else if(pl>mid)return findmn(p,mid+1,r,pl,pr);
//     else return min(findmn(p,l,mid,pl,pr),findmn(p,mid+1,r,pl,pr) );
// }
//
// int findmx(int p,int l,int r,int pl,int pr) {
//     if(pl<=r&&r<=pr) {
//         return tr[p].mx;
//     }
//     int mid=(l+r)/2;
//     if(pr<=mid)return  findmx(p,l,mid,pl,pr);
//     else if(pl>mid)return findmx(p,mid+1,r,pl,pr);
//     else return max(findmx(p,l,mid,pl,pr),findmx(p,mid+1,r,pl,pr) );
// }
//5 7 3 6
const int N=3e5+10;
int dfn[N],low[N];


vector<int> mp[N][30];
void solve() {
    int n,q,m,k;
    cin>>n>>q>>m>>k;
    for(int i=1;i<=n;i++){
        string s;
        cin>>s;
        for(int j=0;j<s.length();j++){
            mp[j][s[j]-'a'].push_back(i);
        }
    }

    while(q--) {
        string s;
        cin>>s;
        vector<int> cnt(310,m);
        for(int i=0;i<s.length();i++) {
            for(auto o:mp[i][s[i]-'a']) {
                cnt[o]--;
            }
        }
        int ans=0;
        for(int i=1;i<=n;i++) {
            //cout<<cnt[i]<<" ";
            if(cnt[i]<=k)ans++;
        }
        cout<<ans<<endl;
    }

}

signed main(){

#ifdef ACM
     freopen("input.in","r",stdin);
     freopen("output.out","w",stdout);
#endif
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int T=1;
    //init();
    //cin>>T;
    while(T--) {
        solve();
    }
    return 0;
}
/*

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 9ms
memory: 3856kb

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

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: 0
Accepted
time: 9ms
memory: 3568kb

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...

output:

300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
...

result:

ok 300 numbers

Test #4:

score: 0
Accepted
time: 9ms
memory: 3688kb

input:

300 300 10 10
qoecfhznxd
hkoaiunzim
lhtzdmbrjs
vqesfzpiuv
amsgqjxmbq
vptwyshswk
sofrfmsrpf
eplnexhmoh
gcjtqavjga
azytravylz
akpuemdfpq
oxkacujrhg
bsgieguzuo
bojvtfkbdf
pmqmrbceej
zgpfkqfeyx
qkdbfrxqcj
effpkigdcw
kqyqmgjdzr
czlbscrnaq
rymhkenugz
fuybclhlhj
rtmclsdvwy
rhfbfqfrfs
bpemthjxfi
jtcvqyltgj
...

output:

300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
...

result:

ok 300 numbers

Test #5:

score: 0
Accepted
time: 9ms
memory: 3700kb

input:

300 300 11 10
lonodhfyrbj
njzuczzviuj
usovdmjfjco
bljtnmsjhut
kkkeybjagck
tbuivwfvjit
qhjzqocsvod
ayobjbagcgv
dudupzsvqpe
tcapottzyte
wdevxapvocr
hsvdfaahndr
jjplhydycgn
srrtpmqmygw
gjjbcchwcur
uivvuqldryj
amlidxfsobz
ofpnwqrzhly
eolqcyidojx
jpiybuplwcf
jmxxtjnwsru
ivkbixrgnph
txjjppqkxgu
vmmbwxmvjd...

output:

96
109
114
108
108
95
108
109
113
106
104
94
111
108
95
107
91
99
111
101
105
116
117
109
106
115
116
96
108
95
114
87
94
116
95
97
104
107
91
103
103
92
115
103
120
102
115
103
101
105
108
95
118
106
91
98
99
115
101
106
120
91
118
91
111
99
104
101
104
96
98
116
111
110
107
118
94
96
103
107
108
1...

result:

ok 300 numbers

Test #6:

score: 0
Accepted
time: 3ms
memory: 3708kb

input:

300 300 11 10
bacdccbdbba
ccabcddcbdc
ddbcccadbab
cbdcabcddbd
ccddbaacaba
addabdbbcba
ccbcbadadac
cbadacadcbb
abddacbcada
ccccbdccdda
dadcbdbddda
acbdccdbcdc
bbbbdbcdcbc
cdcbabdacda
acbcdaaadbc
dccbdcddcca
abbacddccba
cccabdcacda
ddcadbabbca
babaaabbabd
dabdaacaddc
cabcacbdcda
cdbbbdcddcd
cdbdccadda...

output:

287
292
286
279
286
285
289
289
294
284
287
291
287
286
283
275
284
291
289
289
286
291
287
282
290
282
278
288
285
285
285
289
287
283
287
290
287
288
292
288
286
290
290
288
289
285
289
276
286
289
283
279
288
288
288
289
289
286
281
288
291
290
287
289
285
280
289
287
286
295
284
285
286
279
284
...

result:

ok 300 numbers

Test #7:

score: 0
Accepted
time: 10ms
memory: 3672kb

input:

300 300 15 10
bbjbbbjbjbbjjbb
bbjbbbbjbjjjbbb
jbjjjjbjbbjbjbb
bbjjjbjbbjbbjbb
bjbjjjbbbbbbbbb
bjbjbjjjbjjjjjj
bbbjjbbjjjbjjjb
bjbbjbjbjbjjjjj
bbbbbjbjjjjbjbj
bbbjbbbbjbjjjjb
jjjbbbbbbbjjbbj
jbbjjjbbbbjbjbb
bjjbbjbjbjbjjjj
bbjbbjbjbjjbbbb
jbjjjjbbbbjjjbj
bbbbjbbbbbjjbjj
jbjbjjbbjjbjjjb
jjbjbjjbbbjjjj...

output:

279
285
291
281
283
277
281
280
282
280
286
290
279
281
279
286
279
281
279
284
283
279
288
276
288
285
285
278
283
281
284
279
286
283
273
286
286
282
282
288
289
275
279
280
286
288
274
273
280
288
280
283
280
280
285
282
277
282
284
280
284
282
291
280
283
280
288
288
287
275
275
286
286
284
281
...

result:

ok 300 numbers

Test #8:

score: -100
Time Limit Exceeded

input:

300 300 59999 10
qfsnaxtgssrzcvtxmwamjekdujnlymqklnmmwqpgmqljtgtgcitmjkinsdsjijxjtxrvhqjxupgryqcyatbjjzvcosvynyyaohyeqkrrqlbwsabqtkbwtkgnyadcpwwqswkokpkjblkfyrdeugvpvzefduxwtxzdnqvflsagkfwtowcjuseqqzbgrnxapdpvnuiwexirodxtmenhmvyafucenakdqwjfsepgawzpfqozzybdbkqoxyverfgtrezznsvwpjeeiahjcaatwbsuoyxwpwi...

output:


result: