0分求调(玄关)
查看原帖
0分求调(玄关)
926438
_Ljy楼主2025/7/30 19:40
#include<bits/stdc++.h>
using namespace std;
int n,ans;
string s;
unsigned long long h[1000086],t[1000086];
int main()
{
	cin>>s;
	t[0]=1;
	for(int i=1;i<s.size();i++)
	{
		h[i]=h[i-1]+s[i]*t[i-1];
		t[i]=t[i-1]*127;
	}
	cin>>n;
	while(n--)
	{
		int l1,l2,r1,r2;
		cin>>l1>>r1>>l2>>r2;
		if(r1-l1!=r2-l2)	cout<<"No"<<endl;
		if(l1>l2)
		{
			swap(l1,l2);
			swap(r1,r2);
		}
		if((h[r1]-h[l1-1])*t[l2-l1]==h[r2]-h[l2-1])	cout<<"Yes"<<endl;
		else	cout<<"No"<<endl;
	}
	return 0;
}
2025/7/30 19:40
加载中...