Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Hash,不用后缀数组,235MS不犹豫

Posted by NeverWin at 2011-06-27 12:20:33 on Problem 3623
对原串,计算从每个位置开始的连续sqrt(N)个字符组成的串的hash值。
在比较字符串的时候,快速跳过相同的前缀。
int greater(int i,int j){
	while (i+L<=N && j+L<=N && hA[i]==hB[j])i+=L,j+=L;
	while (A[i] || B[j]){
		if (A[i]<B[j])return 0;
		if (A[i]>B[j])return 1;
		i++;j++;
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator