代码求条!!!
查看原帖
代码求条!!!
1417133
_Ambers_楼主2024/8/17 22:10
#include<cstdio>
#include<cstring>
#include<vector>
struct node{
	std::vector<char>vec;
};
bool operator < (node a,node b){
	int n=a.vec.size(),m=b.vec.size();
	//if(n!=m) return n<m;
	for(int i=0;i<n;i++)
		if(a.vec[i]<b.vec[i]&&a.vec[i]!=b.vec[i]) return true;
		else if(a.vec[i]!=b.vec[i]) return true;
	return false;
}
bool operator == (node a,node b){
	return !(a<b)&&!(b<a);
}
int main(){
	int T;
	scanf("%d",&T);
	for(int i=1;i<=T;i++){
		int n,m;
		scanf("%d%d",&n,&m);
		node x,y;
		{
			char c;
			for(int j=1;j<=n;j++)
				scanf("%c",&c),x.vec.push_back(c);
			for(int j=1;j<=n;j++)
				scanf("%c",&c),y.vec.push_back(c);
		}
		puts(x==y?"Yes":"No");
		int o,p;
		char c;
		for(int j=1;j<=m;j++){
			scanf("%d%d %c",&o,&p,&c);
			if(o==0) x.vec[p-1]=c;
			else y.vec[p-1]=c;
			puts(x==y?"Yes":"No");
		}
	}
	return 0;
}
2024/8/17 22:10
加载中...