QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#625005#7618. Pattern SearchJustinWu#WA 0ms3900kbC++14531b2024-10-09 17:08:052024-10-09 17:08:05

Judging History

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

  • [2024-10-09 17:08:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3900kb
  • [2024-10-09 17:08:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int T,a[400],b[400];
char s[2000005];
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%s",s+1);
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
		for(int i=1;i<=strlen(s+1);i++){
			a[s[i]]++;
		}
		scanf("%s",s+1);
		for(int i=1;i<=strlen(s+1);i++){
			b[s[i]]++;
		}
		for(int i='a';i<='z';i++){
			a[i]-=b[i]/2;
			b[i]=b[i]/2+b[i]%2;
		}
		int mi=1e9;
		for(int i='a';i<='z';i++){
			if(b[i])mi=min(mi,a[i]/b[i]);
		}
		printf("%d\n",max(0,mi));
	}
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3852kb

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: 3900kb

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'