QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#404766 | #7618. Pattern Search | ucup-team3215# | WA | 1ms | 3764kb | C++20 | 608b | 2024-05-04 17:45:34 | 2024-05-04 17:45:35 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(0);
for (int tc = (cin >> tc, tc); tc--; ) {
int ct[26]{}, cp[26]{};
string t, p; cin >> t >> p;
for (auto c: t) ++ct[c - 'a'];
for (auto c: p) ++cp[c - 'a'];
int ans = 0;
for (int n = 1; n <= p.size(); ++n) {
int cans = 1e9;
for (int i = 0; i < 26; ++i) if (cp[i]) {
int a = (cp[i] + n) / (n + 1), b = cp[i] - a * n;
cans = min(cans, (ct[i] - (n - 1) * a - b) / a);
}
ans = max(ans, cans);
}
cout << ans << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3764kb
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: 3532kb
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 2 2 0 0 0 0 2
result:
wrong answer 16th numbers differ - expected: '1', found: '2'