QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#311242#7618. Pattern SearchPlentyOfPenalty#WA 0ms3672kbC++20833b2024-01-22 09:15:172024-01-22 09:15:17

Judging History

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

  • [2024-01-22 09:15:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3672kb
  • [2024-01-22 09:15:17]
  • 提交

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'