QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#311242 | #7618. Pattern Search | PlentyOfPenalty# | WA | 0ms | 3672kb | C++20 | 833b | 2024-01-22 09:15:17 | 2024-01-22 09:15:17 |
Judging History
answer
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
using namespace std;
int T, n, m, tt[30], t2[30], ans;
string s, t;
int main() {
#ifdef popteam
freopen("M.in", "r", stdin);
#endif
cin.tie(0)->sync_with_stdio(0);
cin >> T;
while (T--) {
cin >> s >> t;
n = s.size(), m = t.size();
for (int i = 0; i < 26; ++i)
tt[i] = t2[i] = 0;
for (int i = 0; i < m; ++i)
++t2[t[i] - 'a'];
for (int i = 0; i < n; ++i)
++tt[s[i] - 'a'];
for (int i = 1;; ++i) {
for (int j = 0; j < 26; ++j)
if ((t2[j] & 1) * i + (t2[j] >> 1) * (i + 1) > tt[j]) {
ans = i - 1;
goto Skip;
}
}
Skip:
cout << ans << "\n";
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3672kb
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: 3608kb
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'