QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#623754 | #7618. Pattern Search | LX1288# | WA | 1ms | 3868kb | C++14 | 453b | 2024-10-09 13:54:49 | 2024-10-09 13:54:52 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int M=1005;
int tt,n,m;
string s,t;
int main(){
ios::sync_with_stdio(false),cin.tie(0);
cin>>tt;
while(tt--){
int cnt[M]={},cnt1[M]={};
cin>>s>>t;
for(int i=0;i<t.size();i++)cnt[t[i]]++;
for(int i=0;i<s.size();i++)cnt1[s[i]]++;
int mi=1e9;
for(int i='a';i<='z';i++){
if(cnt[i]){
mi=min(mi,cnt1[i]/cnt[i]);
}
}
printf("%d\n",mi);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3868kb
input:
2 bajkaaall aal abca cba
output:
2 1
result:
ok 2 number(s): "2 1"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3848kb
input:
16 a a a b b a aa a ab aa ab b ab c aaz az abcde edcba aaaaaaaaaaaabbb aaaaaaaaabb aaaaaazz az aaaaaaaaaz zzzzz gggggggggggggggggggge ggggeeee hyphyphyphyphyphyphyphyphyphyphyphyp eeeeeeeeee hyphyphyphyphyphyphyphyphyphyphyphype eeteeteeteet aaaabbbbbbcccccccc aaabbbbbcccccc
output:
1 0 0 2 0 1 0 1 1 1 2 0 0 0 0 1
result:
wrong answer 10th numbers differ - expected: '2', found: '1'