QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#246118#4666. Delete And Winsherman2023WA 0ms3776kbC++14879b2023-11-10 16:21:012023-11-10 16:21:01

Judging History

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

  • [2023-11-10 16:21:01]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3776kb
  • [2023-11-10 16:21:01]
  • 提交

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'