QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#246118 | #4666. Delete And Win | sherman2023 | WA | 0ms | 3776kb | C++14 | 879b | 2023-11-10 16:21:01 | 2023-11-10 16:21:01 |
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 && j > m) {
ans ++;
break;
}
if(j > m) break;
if(t[j] < s[i]) break;
if(tmp[cnt] > t[j]) {
ans ++;
break;
}else{
if(i > n) {
ans += m - j + 2;
break;
}
ans ++;
j ++;
}
}
printf("%d\n", ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3776kb
input:
pqsrpspqz pqrpqz
output:
0
result:
wrong answer 1st numbers differ - expected: '2', found: '0'