QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#245920 | #4666. Delete And Win | sherman2023 | WA | 1ms | 3788kb | C++14 | 800b | 2023-11-10 14:39:18 | 2023-11-10 14:39:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 5;
int n, m, cnt = 0;
char s[N], t[N], tmp[N];
int main() {
// freopen("string.in", "r", stdin);
// freopen("string.out", "w", stdout);
scanf("%s", s + 1);
scanf("%s", t + 1);
n = strlen(s + 1), m = strlen(t + 1);
int i = 1, j = 1, ans = 0;
while(i <= n && j <= m) {
int isok = 1;
while(i <= n && j <= m && s[i] == t[j]) {
tmp[++ cnt] = s[i];
if(tmp[cnt - 1] > tmp[cnt]) {
ans ++, isok = 0;
break;
}
i ++, j ++;
}
if(!isok) break;
if(i > n) {
ans += m - j + 2;
break;
}
if(j > m) break;
if(t[j] < s[i]) break;
ans ++;
if(tmp[cnt] > t[j]) {
break;
}else j ++;
}
printf("%d\n", ans);
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3788kb
input:
pqsrpspqz pqrpqz
output:
0
result:
wrong answer 1st numbers differ - expected: '2', found: '0'